「Raspbian Stretchの初期設定」の版間の差分
提供: オレッジベース
(同じ利用者による、間の4版が非表示) | |||
1行目: | 1行目: | ||
− | + | === password変更 === | |
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo passwd pi | $ sudo passwd pi | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | === update === | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | $ sudo apt- | + | $ sudo apt install rpi-update |
− | $ sudo apt | + | $ sudo rpi-update |
+ | $ sudo apt update | ||
+ | $ sudo apt dist-upgrade -y | ||
+ | $ sudo reboot | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | === ユーザー「pi」の名前変更 === | |
− | + | ==== 一時的にsudoが使えるユーザー作成 ==== | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo adduser <TEMP_USER_NAME> | $ sudo adduser <TEMP_USER_NAME> | ||
18行目: | 20行目: | ||
$ exit | $ exit | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ==== <TEMP_USER_NAME>でログイン ==== | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo usermod -l <NEW_USER_NAME> pi | $ sudo usermod -l <NEW_USER_NAME> pi | ||
25行目: | 27行目: | ||
$ exit | $ exit | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ==== <NEW_USER_NAME>でログインして<TEMP_USER_NAME>削除 ==== | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo deluser temp --remove-home | $ sudo deluser temp --remove-home | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | === raspi-config === | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo raspi-config | $ sudo raspi-config | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ==== Change User Password ==== | |
: skip | : skip | ||
− | + | ==== Network Options ==== | |
: Hostname : <HOST_NAME><br /> | : Hostname : <HOST_NAME><br /> | ||
: Wi-fi : skip<br /> | : Wi-fi : skip<br /> | ||
: Network Interface names : enable | : Network Interface names : enable | ||
− | + | ==== Boot Options ==== | |
: skip | : skip | ||
− | + | ==== Localisation Options ==== | |
: Change Locale : ja_JP.UTF-8 UTF-8<br /> | : Change Locale : ja_JP.UTF-8 UTF-8<br /> | ||
: Change Timezone : Asia/Tokyo | : Change Timezone : Asia/Tokyo | ||
− | + | ==== Interfacing Options ==== | |
: ssh : enable | : ssh : enable | ||
− | + | ==== Overclock ==== | |
: skip | : skip | ||
− | + | ==== Advanced Options ==== | |
: Expand Filesystem : select<br /> | : Expand Filesystem : select<br /> | ||
: Memory Split : 16 | : Memory Split : 16 | ||
− | + | ==== Update ==== | |
: select | : select | ||
− | === | + | === vimをインストールして設定 === |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | $ sudo apt | + | $ sudo apt install -y vim |
$ sudo vim /etc/vim/vimrc | $ sudo vim /etc/vim/vimrc | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | 以下を追記 | ||
+ | <pre> | ||
+ | set encoding=utf-8 | ||
+ | set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8 | ||
+ | set fileformats=unix,dos,mac | ||
− | ==== IPアドレスの固定 | + | set fenc=utf-8 |
+ | set nobackup | ||
+ | set noswapfile | ||
+ | set autoread | ||
+ | set hidden | ||
+ | set showcmd | ||
+ | set number | ||
+ | set cursorline | ||
+ | set virtualedit=onemore | ||
+ | set smartindent | ||
+ | set visualbell | ||
+ | set showmatch | ||
+ | set laststatus=2 | ||
+ | set wildmode=list:longest | ||
+ | nnoremap j gj | ||
+ | nnoremap k gk | ||
+ | set list listchars=tab:\▸\- | ||
+ | set expandtab | ||
+ | set tabstop=2 | ||
+ | set shiftwidth=2 | ||
+ | set ignorecase | ||
+ | set smartcase | ||
+ | set incsearch | ||
+ | set wrapscan | ||
+ | set hlsearch | ||
+ | nmap <Esc><Esc> :nohlsearch<CR><Esc> | ||
+ | </pre> | ||
+ | |||
+ | === IPアドレスの固定 === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ ifconfig | $ ifconfig |
2018年8月23日 (木) 16:38時点における最新版
password変更
$ sudo passwd pi
update
$ sudo apt install rpi-update
$ sudo rpi-update
$ sudo apt update
$ sudo apt dist-upgrade -y
$ sudo reboot
ユーザー「pi」の名前変更
一時的にsudoが使えるユーザー作成
$ sudo adduser <TEMP_USER_NAME>
$ sudo gpasswd -a <TEMP_USER_NAME> sudo
$ exit
<TEMP_USER_NAME>でログイン
$ sudo usermod -l <NEW_USER_NAME> pi
$ sudo usermod -d /home/<NEW_USER_NAME> -m <NEW_USER_NAME>
$ sudo groupmod -n <NEW_USER_NAME> pi
$ exit
<NEW_USER_NAME>でログインして<TEMP_USER_NAME>削除
$ sudo deluser temp --remove-home
raspi-config
$ sudo raspi-config
Change User Password
- skip
Network Options
- Hostname : <HOST_NAME>
- Wi-fi : skip
- Network Interface names : enable
Boot Options
- skip
Localisation Options
- Change Locale : ja_JP.UTF-8 UTF-8
- Change Timezone : Asia/Tokyo
Interfacing Options
- ssh : enable
Overclock
- skip
Advanced Options
- Expand Filesystem : select
- Memory Split : 16
Update
- select
vimをインストールして設定
$ sudo apt install -y vim
$ sudo vim /etc/vim/vimrc
以下を追記
set encoding=utf-8 set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8 set fileformats=unix,dos,mac set fenc=utf-8 set nobackup set noswapfile set autoread set hidden set showcmd set number set cursorline set virtualedit=onemore set smartindent set visualbell set showmatch set laststatus=2 set wildmode=list:longest nnoremap j gj nnoremap k gk set list listchars=tab:\▸\- set expandtab set tabstop=2 set shiftwidth=2 set ignorecase set smartcase set incsearch set wrapscan set hlsearch nmap <Esc><Esc> :nohlsearch<CR><Esc>
IPアドレスの固定
$ ifconfig
IPを固定するNICのinterface名を確認
$ sudo vim /etc/dhcpcd.conf
以下を追記
interface <INTERFACE_NAME> static ip_address=<IP_ADDRESS>/24 static routers=<ROUTER_IP_ADDRESS> static domain_name_servers=<DNS_SERVER_IP_ADDRESS> 8.8.8.8 fd51:42f8:caae:d92e::1