#author("2021-02-20T14:18:26+09:00","","")
#author("2021-02-20T14:19:42+09:00","","")
#nofollow
#norelated
総数:&counter(total); 今日:&counter(today); 昨日:&counter(yesterday);

* もくじ [#oc911c39]

#contents

* sudoパスワード入力を省略する設定 [#hf3931c4]
 ~$ sudo bash
 [sudo] <username>のパスワード:
 ~# vi /etc/sudoers.d/<username>

**以下のとおりに入力してファイル保存する。 [#t02194a5]
 <username> ALL=NOPASSWD: ALL

**access権を設定する。 [#d785d0ef]
 ~# chmod 440 /etc/sudoers.d/<username>
 ~# exit
 

* proxyの設定 [#k0c58d14]
**環境変数 [#d145deea]
***/etc/profile に下記を追記する。 [#x3d52107]
 export https_proxy="http://[address]:[port]"
 export http_proxy=$https_proxy
 export ftp_proxy=$https_proxy
 export proxy=$https_proxy
 export HTTPS_PROXY=$https_proxy
 export HTTP_PROXY=$https_proxy
 export FTP_PROXY=$https_proxy
 export PROXY=$https_proxy
 export all_proxy="socks5://[socks_proxy]:1080"

***~/.bashrc に下記を追記する。 [#ybe7588b]
 export https_proxy="http://[address]:[port]"
 export http_proxy=$https_proxy
 export ftp_proxy=$https_proxy
 export proxy=$https_proxy
 export HTTPS_PROXY=$https_proxy
 export HTTP_PROXY=$https_proxy
 export FTP_PROXY=$https_proxy
 export PROXY=$https_proxy

**apt [#v87dfdce]
***/etc/apt/apt.conf.d/proxy.conf [#le330987]
 Acquire::http::Proxy "http://user:password@proxy.server:port/";
 Acquire::https::Proxy "http://user:password@proxy.server:port/";

**wget [#r61f6cb9]
***/etc/wgetrc [#k8342807]
 https_proxy=http://[address]:[port]/
 http_proxy=http://[address]:[port]/
 ftp_proxy=http://[address]:[port]/

*** ~/.wgetrc [#sa0e0e27]
 https_proxy=http://[address]:[port]/
 http_proxy=http://[address]:[port]/
 ftp_proxy=http://[address]:[port]/
 proxy_user=${user}
 proxy_password=${pass}

**curl [#t3e523b4]
***~/.curlrc [#kd1ba261]
 proxy-user = "username:password"
 proxy = "http://[address]:[port]"

* apt get [#sbd45f6d]
 ~$ sudo apt update
 ~$ sudo apt install net-tools
 ~$ sudo apt install cifs-utils

* ''自ipアドレスの確認'' [#s1025938]

-下記コマンドにて enp0s3 などネットワークアダプタ の inetアドレス を確認する。
 ~$ ifconfig

 enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.12  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 2400:2653:4e41:5900:b3ba:c58b:aa96:5662  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::eee0:69c7:1f86:9fd0  prefixlen 64  scopeid 0x20<link>
        inet6 2400:2653:4e41:5900:3f9c:98c5:693a:c000  prefixlen 64  scopeid 0x0<global>
        ether 08:00:27:ad:38:aa  txqueuelen 1000  (イーサネット)
        RX packets 20322  bytes 17229442 (17.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14894  bytes 3765850 (3.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (ローカルループバック)
        RX packets 2538  bytes 222796 (222.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2538  bytes 222796 (222.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 

* ''ホーム配下のディレクトリ名を英語にリネームする'' [#ofc49aa5]
 ~$ LANG=C xdg-user-dirs-gtk-update

* ''sudoコマンドでパスワード入力省略可能とする'' [#s29b653c]
**/etc/sudoers.d/<username>というファイルを新規作成する。 [#f266f5d4]
 ~$ sudo gedit /etc/sudoers.d/<username>
**以下の通りにファイル編集・保存する [#ucbc51f3]
 <username> ALL=NOPASSWD: ALL
**permission変更する [#l8666662]
 ~$ sudo chmod 440 /etc/sudoers.d/<username>


* ''ubuntuのアップデート'' [#s784fc12]
 ~$ sudo apt-get -y update

* ''gvim のインストール'' [#h8a347da]
 ~$ sudo apt install vim
 ~$ sudo apt install vim-gtk3

**gvimの設定例( .vimrc の作成 ) [#pdea122b]
 ~$ cat <<EOF > .vimrc
 set guifont=Courier\ 10
 set number
 set cursorline
 set clipboard=unnamedplus
 command! -nargs=1 Grep call s:Grep(<f-args>)
 
 function! s:Grep(command)
 let orig_grepprg = &l:grepprg
 let &l:grepprg = substitute(a:command, '|', '\\|', 'g')
 grep
 let &l:grepprg = orig_grepprg
 endfunction
 
 set encoding=utf-8
 EOF


**全ユーザーに適用するgvimの設定例 [#z69dca37]
system wide な設定ファイル vimrc は /etc/vim/vimrc にあるが,&br;
vimrc を直接編集するのではなく,/etc/vim/vimrc.local を置いて記述する。&br;

 ~$ sudo bash

 # cat <<EOF > /etc/vim/vimrc.local
 set guifont=Courier\ 10
 set number
 set cursorline
 set clipboard=unnamedplus
 command! -nargs=1 Grep call s:Grep(<f-args>)
 
 function! s:Grep(command)
 let orig_grepprg = &l:grepprg
 let &l:grepprg = substitute(a:command, '|', '\\|', 'g')
 grep
 let &l:grepprg = orig_grepprg
 endfunction
 
 set encoding=utf-8
 EOF

 # exit


**system wide な設定ファイル  /etc/vim/vimrc のデフォルト内容 [#kdd64036]
 ~$ ls -la /etc/vim/vimrc
 -rw-r--r-- 1 root root 2266  1月 30  2020 /etc/vim/vimrc

 ~$ cat /etc/vim/vimrc

 " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
 " the call to :runtime you can find below.  If you wish to change any of those
 " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
 " will be overwritten everytime an upgrade of the vim packages is performed.
 " It is recommended to make changes after sourcing debian.vim since it alters
 " the value of the 'compatible' option.
 
 runtime! debian.vim
 
 " Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
 " This happens after /etc/vim/vimrc(.local) are loaded, so it will override
 " any settings in these files.
 " If you don't want that to happen, uncomment the below line to prevent
 " defaults.vim from being loaded.
 " let g:skip_defaults_vim = 1
 
 " Uncomment the next line to make Vim more Vi-compatible
 " NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
 " options, so any other options should be set AFTER setting 'compatible'.
 "set compatible
 
 " Vim5 and later versions support syntax highlighting. Uncommenting the next
 " line enables syntax highlighting by default.
 if has("syntax")
   syntax on
 endif
 
 " If using a dark background within the editing area and syntax highlighting
 " turn on this option as well
 "set background=dark
 
 " Uncomment the following to have Vim jump to the last position when
 " reopening a file
 "au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
 
 " Uncomment the following to have Vim load indentation rules and plugins
 " according to the detected filetype.
 "filetype plugin indent on
 
 " The following are commented out as they cause vim to behave a lot
 " differently from regular Vi. They are highly recommended though.
 "set showcmd		" Show (partial) command in status line.
 "set showmatch		" Show matching brackets.
 "set ignorecase		" Do case insensitive matching
 "set smartcase		" Do smart case matching
 "set incsearch		" Incremental search
 "set autowrite		" Automatically save before commands like :next and :make
 "set hidden		" Hide buffers when they are abandoned
 "set mouse=a		" Enable mouse usage (all modes)
 
 " Source a global configuration file if available
 if filereadable("/etc/vim/vimrc.local")
   source /etc/vim/vimrc.local
 endif
 
 




* ''git のインストール'' [#he534aff]
 ~$ sudo apt install git-core

 パッケージリストを読み込んでいます... 完了
 依存関係ツリーを作成しています                
 状態情報を読み取っています... 完了
 注意、'git-core' の代わりに 'git' を選択します
 以下の追加パッケージがインストールされます:
   git-man liberror-perl
 提案パッケージ:
   git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki
   git-svn
 以下のパッケージが新たにインストールされます:
   git git-man liberror-perl
 アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 0 個。
 5,464 kB のアーカイブを取得する必要があります。
 この操作後に追加で 38.4 MB のディスク容量が消費されます。
 続行しますか? [Y/n] Y
 取得:1 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 liberror-perl all 0.17029-1 [26.5 kB]
 取得:2 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 git-man all 1:2.25.1-1ubuntu3 [884 kB]
 取得:3 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 git amd64 1:2.25.1-1ubuntu3 [4,554 kB]
 5,464 kB を 2秒 で取得しました (3,325 kB/s)
 以前に未選択のパッケージ liberror-perl を選択しています。
 (データベースを読み込んでいます ... 現在 195312 個のファイルとディレクトリがインストールされています。)
 .../liberror-perl_0.17029-1_all.deb を展開する準備をしています ...
 liberror-perl (0.17029-1) を展開しています...
 以前に未選択のパッケージ git-man を選択しています。
 .../git-man_1%3a2.25.1-1ubuntu3_all.deb を展開する準備をしています ...
 git-man (1:2.25.1-1ubuntu3) を展開しています...
 以前に未選択のパッケージ git を選択しています。
 .../git_1%3a2.25.1-1ubuntu3_amd64.deb を展開する準備をしています ...
 git (1:2.25.1-1ubuntu3) を展開しています...
 liberror-perl (0.17029-1) を設定しています ...
 git-man (1:2.25.1-1ubuntu3) を設定しています ...
 git (1:2.25.1-1ubuntu3) を設定しています ...
 man-db (2.9.1-1) のトリガを処理しています ...
 


**git の設定 [#na876ea0]
-設定準備
 ~$ cat <<EOF > create_gitconfig.sh
 #!/bin/bash
 how_many_params=\$#
 echo "how_many_params: \${how_many_params}"
 if [ \${how_many_params} -ne 2 ] ; then
   echo "error: illegal parameters."
   exit 1
 fi
 git config --global user.name "\$1"
 git config --global user.email "\$2"
 git config --global color.ui auto
 git config --global core.editor vim
 echo "---- .gitconfig ----"
 cat .gitconfig
 echo "---- .gitconfig end----"
 exit 0
 EOF

 ~$ chmod a+x create_gitconfig.sh

-設定実行
 ~$ ./create_gitconfig.sh "user_full_name" "mailaddress"
例
 ~$ ./create_gitconfig.sh "John Smith" "john.smith@domain"

-設定ファイル内容確認
 ~$ cat .gitconfig

* ''gitk のインストール'' [#r14b9cec]
 ~$ sudo apt install gitk

  パッケージリストを読み込んでいます... 完了
 依存関係ツリーを作成しています                
 状態情報を読み取っています... 完了
 以下の追加パッケージがインストールされます:
   libtk8.6 tcl tcl8.6 tk tk8.6
 提案パッケージ:
   git-doc tcl-tclreadline
 以下のパッケージが新たにインストールされます:
   gitk libtk8.6 tcl tcl8.6 tk tk8.6
 アップグレード: 0 個、新規インストール: 6 個、削除: 0 個、保留: 0 個。
 891 kB のアーカイブを取得する必要があります。
 この操作後に追加で 4,207 kB のディスク容量が消費されます。
 続行しますか? [Y/n] Y
 取得:1 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 libtk8.6 amd64 8.6.10-1 [714 kB]
 取得:2 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 tk8.6 amd64 8.6.10-1 [12.5 kB]
 取得:3 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 tcl8.6 amd64 8.6.10+dfsg-1 [14.8 kB]
 取得:4 http://jp.archive.ubuntu.com/ubuntu focal/universe amd64 tcl amd64 8.6.9+1 [5,112 B]
 取得:5 http://jp.archive.ubuntu.com/ubuntu focal/universe amd64 tk amd64 8.6.9+1 [3,240 B]
 取得:6 http://jp.archive.ubuntu.com/ubuntu focal/universe amd64 gitk all 1:2.25.1-1ubuntu3 [142 kB]
 891 kB を 1秒 で取得しました (1,337 kB/s)
 以前に未選択のパッケージ libtk8.6:amd64 を選択しています。
 (データベースを読み込んでいます ... 現在 196247 個のファイルとディレクトリがインストールされています。)
 .../0-libtk8.6_8.6.10-1_amd64.deb を展開する準備をしています ...
 libtk8.6:amd64 (8.6.10-1) を展開しています...
 以前に未選択のパッケージ tk8.6 を選択しています。
 .../1-tk8.6_8.6.10-1_amd64.deb を展開する準備をしています ...
 tk8.6 (8.6.10-1) を展開しています...
 以前に未選択のパッケージ tcl8.6 を選択しています。
 .../2-tcl8.6_8.6.10+dfsg-1_amd64.deb を展開する準備をしています ...
 tcl8.6 (8.6.10+dfsg-1) を展開しています...
 以前に未選択のパッケージ tcl を選択しています。
 .../3-tcl_8.6.9+1_amd64.deb を展開する準備をしています ...
 tcl (8.6.9+1) を展開しています...
 以前に未選択のパッケージ tk を選択しています。
 .../4-tk_8.6.9+1_amd64.deb を展開する準備をしています ...
 tk (8.6.9+1) を展開しています...
 以前に未選択のパッケージ gitk を選択しています。
 .../5-gitk_1%3a2.25.1-1ubuntu3_all.deb を展開する準備をしています ...
 gitk (1:2.25.1-1ubuntu3) を展開しています...
 tcl8.6 (8.6.10+dfsg-1) を設定しています ...
 libtk8.6:amd64 (8.6.10-1) を設定しています ...
 tcl (8.6.9+1) を設定しています ...
 tk8.6 (8.6.10-1) を設定しています ...
 tk (8.6.9+1) を設定しています ...
 gitk (1:2.25.1-1ubuntu3) を設定しています ...
 man-db (2.9.1-1) のトリガを処理しています ...
 libc-bin (2.31-0ubuntu9.2) のトリガを処理しています ...
 

* ''言語サポートで日本語を有効にする。'' [#z08577a3]
**デスクトップ 画面にて [#u8a16503]
***右上のAのアイコンを選択する。 [#fcff5f66]
***日本語(Mozc) を選択する。 [#c2338f4a]
-右上のキーボードのアイコンが「あ」に変われば OK。


* ''再起動する'' [#c15760a8]
-ログインしておく。


*curlのインストール [#zb5bf63a]
 ~$ sudo apt install curl

 パッケージリストを読み込んでいます... 完了
 依存関係ツリーを作成しています                
 状態情報を読み取っています... 完了
 以下のパッケージが新たにインストールされます:
   curl
 アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 18 個。
 161 kB のアーカイブを取得する必要があります。
 この操作後に追加で 411 kB のディスク容量が消費されます。
 取得:1 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 curl amd64 7.68.0-1ubuntu2.4 [161 kB]
 161 kB を 0秒 で取得しました (572 kB/s)
 以前に未選択のパッケージ curl を選択しています。
 (データベースを読み込んでいます ... 現在 209168 個のファイルとディレクトリがインストールされています。)
 .../curl_7.68.0-1ubuntu2.4_amd64.deb を展開する準備をしています ...
 curl (7.68.0-1ubuntu2.4) を展開しています...
 curl (7.68.0-1ubuntu2.4) を設定しています ...
 man-db (2.9.1-1) のトリガを処理しています ...


* sshの準備 client側 [#z9dc7c5e]

** 公開鍵が既に作成されているかどうか確認する [#ld7b02d9]

***ある場合は、公開鍵は ~/.ssh というディレクトリにあるはず。 [#i24668d4]
 ~$ ls -la .ssh
-ある場合は、<filename>と<filename.pub>というペアのファイルたちがある。
 <filename>が秘密鍵
 <filename.pub>が公開鍵

** 公開鍵がまだ無い場合は作成する [#d5d5d734]

***ssh-keygenコマンドで作成する。 [#qe64c324]
 ~$ ssh-keygen

 Generating public/private rsa key pair.
 Enter file in which to save the key (/home/<username>/.ssh/id_rsa):←★このままenterキーを押す 
 Created directory '/home/<username>/.ssh'.
 Enter passphrase (empty for no passphrase): ←★このままenterキーを押す
 Enter same passphrase again: ←★このままenterキーを押す
 Your identification has been saved in /home/<username>/.ssh/id_rsa.
 Your public key has been saved in /home/<username>/.ssh/id_rsa.pub.
 The key fingerprint is:
 b6:(・・・省略・・・):07 <username>@<hostname>
 The key's randomart image is:
 +--[ RSA 2048]----+
 |= (・・省略・・) |
 |                 |
 +-----------------+
 ~$

***作成された鍵ファイルを確認する。 [#ic056503]
 ~$ ls -la .ssh

 合計 16
 drwx------  2 ryu ryu 4096  2月 14 11:25 .
 drwxr-xr-x 17 ryu ryu 4096  2月 20 10:31 ..
 -rw-------  1 ryu ryu 2602  2月 14 11:25 id_rsa
 -rw-r--r--  1 ryu ryu  568  2月 14 11:25 id_rsa.pub


*sshの準備 sever側 [#k057febc]

**openssh-serverをインストールしておく。 [#kd382732]
 ~$ sudo apt -y install openssh-server


* ''次は'' [#m7687813]
-android Lollipop開発環境構築の場合は[[setting up Linux build environment for Lollipop]]へ
-LAMP server環境構築の場合は[[installing apache on ubuntu desktop 20.04.2]]へ

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS