Raspbian には Lite版 と 通常版 があるのですが、必要ない物がゴチャゴチャ入っていると気持ち悪いので、Liteを使ってみました。
「通常版に何が入っていてLiteに何がないのか」を比較をしている人がいたので、リンクを貼っておきます。
http://sstea.blog.jp/raspi/raspbian_jessie.html
Raspbian の Lite を microSD に書き込んで、設定・インストールをして使えるようにしていきます。
①ssh を有効にするため、boot パーティションに ssh ファイルの作成
②有線LANの環境がないので Wi-Fi 設定
③raspi-conf で色々設定
1 Expand Filesystem
![2016-12-18_22h05_27-1-expand-filesystem](http://www.an10.info/wp-content/uploads/2016-12-18_22h05_27-1-Expand-Filesystem.png)
Finish で raspi-config を終わらせると再起動をするようにうながされます。
![2016-12-18_22h05_30-finish](http://www.an10.info/wp-content/uploads/2016-12-18_22h05_30-Finish.png)
![2016-12-18_22h05_34-reboot](http://www.an10.info/wp-content/uploads/2016-12-18_22h05_34-reboot.png)
![2016-12-18_22h05_47-reboot-now](http://www.an10.info/wp-content/uploads/2016-12-18_22h05_47-reboot-now.png)
4 Internationalisation Options
I1 Change Locale
![2016-12-18_21h56_32-4-internationalisation-options](http://www.an10.info/wp-content/uploads/2016-12-18_21h56_32-4-Internationalisation-Options.png)
![2016-12-18_21h56_42_i1-change-locale](http://www.an10.info/wp-content/uploads/2016-12-18_21h56_42_I1-Change-Locale.png)
![2016-12-18_21h57_40](http://www.an10.info/wp-content/uploads/2016-12-18_21h57_40.png)
特に日本語化するつもりはなく、jp_JP.UTF-8 にすると文字化けするので en_GB.UTF-8 にしておきます。
![2016-12-18_21h58_05](http://www.an10.info/wp-content/uploads/2016-12-18_21h58_05.png)
4 Internationalisation Options
I2 Change Timezone
![2016-12-18_21h56_32-4-internationalisation-options](http://www.an10.info/wp-content/uploads/2016-12-18_21h56_32-4-Internationalisation-Options.png)
![2016-12-18_21h58_54-change-timezone](http://www.an10.info/wp-content/uploads/2016-12-18_21h58_54-Change-Timezone.png)
![2016-12-18_21h59_18](http://www.an10.info/wp-content/uploads/2016-12-18_21h59_18.png)
![2016-12-18_21h59_37](http://www.an10.info/wp-content/uploads/2016-12-18_21h59_37.png)
4 Internationalisation Options
I3 Change Keeyboard Layout
![2016-12-18_21h56_32-4-internationalisation-options](http://www.an10.info/wp-content/uploads/2016-12-18_21h56_32-4-Internationalisation-Options.png)
![2016-12-19_03h49_50-i3-change-keyboard-layout](http://www.an10.info/wp-content/uploads/2016-12-19_03h49_50-I3-Change-Keyboard-Layout.png)
![2016-12-19_03h50_15](http://www.an10.info/wp-content/uploads/2016-12-19_03h50_15.png)
![2016-12-19_03h50_26](http://www.an10.info/wp-content/uploads/2016-12-19_03h50_26.png)
![2016-12-19_03h57_46](http://www.an10.info/wp-content/uploads/2016-12-19_03h57_46.png)
![2016-12-19_03h59_18](http://www.an10.info/wp-content/uploads/2016-12-19_03h59_18.png)
![2016-12-19_03h59_42](http://www.an10.info/wp-content/uploads/2016-12-19_03h59_42.png)
![2016-12-19_04h00_16](http://www.an10.info/wp-content/uploads/2016-12-19_04h00_16.png)
4 Internationalisation Options
I4 Change Wi-Fi Countory
国によって使えるWi-Fiのチャンネルが違うため設定するそうです。
日本は全チャンネル使えるそうですが、国によっては使えないそうなので日本にしておきます。
![2016-12-18_21h56_32-4-internationalisation-options](http://www.an10.info/wp-content/uploads/2016-12-18_21h56_32-4-Internationalisation-Options.png)
![2016-12-18_22h11_16-i4-change-wi-fi-countory](http://www.an10.info/wp-content/uploads/2016-12-18_22h11_16-I4-Change-Wi-Fi-Countory.png)
![2016-12-18_22h11_36](http://www.an10.info/wp-content/uploads/2016-12-18_22h11_36.png)
![2016-12-18_22h11_44](http://www.an10.info/wp-content/uploads/2016-12-18_22h11_44.png)
7 Advanced Options
A8 Serial
GPIO のシリアルは何かあったとき使いたいので有効にしておきます。
![2016-12-18_22h01_51-7-advanced-options](http://www.an10.info/wp-content/uploads/2016-12-18_22h01_51-7-Advanced-Options.png)
![2016-12-18_22h02_01-serial](http://www.an10.info/wp-content/uploads/2016-12-18_22h02_01-Serial.png)
![2016-12-18_22h02_10](http://www.an10.info/wp-content/uploads/2016-12-18_22h02_10.png)
![2016-12-18_22h02_21](http://www.an10.info/wp-content/uploads/2016-12-18_22h02_21.png)
2 Change User Password
Change User Password で Pi のパスワードを変更しておきます。
![2016-12-19_04h31_40-2-change-user-password](http://www.an10.info/wp-content/uploads/2016-12-19_04h31_40-2-change-User-Password.png)
![2016-12-19_04h31_54](http://www.an10.info/wp-content/uploads/2016-12-19_04h31_54.png)
![2016-12-19_04h33_49](http://www.an10.info/wp-content/uploads/2016-12-19_04h33_49.png)
![2016-12-19_04h34_01](http://www.an10.info/wp-content/uploads/2016-12-19_04h34_01.png)
![2016-12-19_04h34_09](http://www.an10.info/wp-content/uploads/2016-12-19_04h34_09.png)
ファイアウォール設定ソフト UFW ( Uncomplicated FireWall ) を入れる
pi@raspberrypi:~ $ sudo apt-get install -y ufw
sudo ufw status でインストール直後の状態をみると Status: inactive と表示されファイアウォールが無効な状態になっているのでデフォルトは拒否する設定にして、SSHの穴をあけて、ファイアウォールを有効な状態にします。
デフォルトの動作を拒否にする
pi@raspberrypi:~ $ sudo ufw default deny
Default incoming policy changed to ‘deny’
(be sure to update your rules accordingly)
SSHを許可設定
pi@raspberrypi:~ $ sudo ufw allow ssh
Rules updated
Rules updated (v6)
ファイアウォールを有効にする
pi@raspberrypi:~ $ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
設定内容を確認
pi@raspberrypi:~ $ sudo ufw status
Status: active
To Action From
— —— —-
22 ALLOW Anywhere
22 ALLOW Anywhere (v6)
テキストエディタ Vim を入れる
sudo apt-get install -y vim
これで下準備は整ったかと。