「Raspbian Stretchの初期設定」の版間の差分

提供: オレッジベース
移動先: 案内検索
(ページの作成:「=== とりあえず最初にやること === ==== password変更 ==== <syntaxhighlight lang="bash"> $ sudo passwd pi </syntaxhighlight> ==== update ==== <syntaxhighlight...」)
 
 
(同じ利用者による、間の5版が非表示)
1行目: 1行目:
=== とりあえず最初にやること ===
+
=== password変更 ===
==== password変更 ====
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ sudo passwd pi
 
$ sudo passwd pi
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== update ====
+
=== update ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ sudo apt-get update
+
$ sudo apt install rpi-update
$ sudo apt-get dist-upgrade -y
+
$ sudo rpi-update
 +
$ sudo apt update
 +
$ sudo apt dist-upgrade -y
 +
$ sudo reboot
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== ユーザー「pi」の名前変更 ====
+
=== ユーザー「pi」の名前変更 ===
===== 一時的にsudoが使えるユーザー作成 =====
+
==== 一時的に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>でログイン =====
+
==== <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>削除 =====
+
==== <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 ====
+
=== raspi-config ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ sudo raspi-config
 
$ sudo raspi-config
 
</syntaxhighlight>
 
</syntaxhighlight>
===== Change User Password =====
+
==== Change User Password ====
 
: skip
 
: skip
===== Network Options =====
+
==== 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 =====
+
==== Boot Options ====
 
: skip
 
: skip
===== Localisation Options =====
+
==== 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 =====
+
==== Interfacing Options ====
 
: ssh : enable
 
: ssh : enable
===== Overclock =====
+
==== Overclock ====
 
: skip
 
: skip
===== Advanced Options =====
+
==== Advanced Options ====
 
: Expand Filesystem : select<br />
 
: Expand Filesystem : select<br />
 
: Memory Split : 16
 
: Memory Split : 16
===== Update =====
+
==== Update ====
 
: select
 
: select
  
==== vimをインストールして初期設定 ====
+
=== vimをインストールして設定 ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ sudo apt-get install -y vim
+
$ 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
 +
 +
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アドレスの固定 ====
+
=== IPアドレスの固定 ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ ifconfig
 
$ ifconfig
76行目: 111行目:
 
static domain_name_servers=<DNS_SERVER_IP_ADDRESS> 8.8.8.8 fd51:42f8:caae:d92e::1
 
static domain_name_servers=<DNS_SERVER_IP_ADDRESS> 8.8.8.8 fd51:42f8:caae:d92e::1
 
</pre>
 
</pre>
 +
 +
 +
[[Category:RaspBerryPi]]
 +
[[Category:Raspbian]]
 +
[[Category:Stretch]]

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