LoginSignup
16
20

More than 5 years have passed since last update.

Raspberry Pi 3を外付けモニター・キーボードなしでセットアップする

Last updated at Posted at 2016-08-07

ラズパイを買ったのはいいものの、外付けキーボードやディスプレイを持ってないし今更買いたくない。。
ということで、普段使っているMacBook Airからsshでラズパイに接続することにした。

参考資料はこちら。
Raspberry Piをモニタ等無しでMacから使えるようにする方法 « TORQUES LABS
Raspberry Pi 3を買ってからやった事の備忘録① - ハードウェアエンジニアの備忘録

用意するもの
・Raspberry Pi 3
・MicroSD Card
・MicroSD Cardリーダ
・USB電源ケーブル
・ケーブル(Thunderbolt <-> 有線LAN)
・ケーブル(有線LAN)

ホームページからRASPBIAN JESSIE LITE(zip)をダウンロード
解凍してimgファイルにしておく

どの辺がSDカードか確認しておく
容量的にdisk2かな

$ diskutil list
/dev/disk0 (internal, physical):
・・・
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.1 GB    disk2
   1:             Windows_FAT_16 RECOVERY                1.2 GB     disk2s1
   2:                      Linux                         33.6 MB    disk2s5

アンマウント

$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

imgが置いてあるディレクトリに移動して書き込み

$ sudo dd bs=1m if=2016-05-27-raspbian-jessie-lite.img of=/dev/disk2
Password:
1323+0 records in
1323+0 records out
1387266048 bytes transferred in 720.379991 secs (1925742 bytes/sec)

書き込みが終わったらSDカードをラズパイに挿して起動
Macとラズパイの接続は有線LAN経由で行うので、 Mac <-> Thunderbolt <-> 有線LAN <-> ラズパイ という感じでつなげる

次はMac側でインターネット共有設定を行う
システム環境設定 -> 共有 -> インターネット共有
共有する接続経路:Wi-Fi、相手のコンピューターでのポート:Thunderbolt Ethernetとする
(2つめは接続方法によって異なる)
ちなみにMacBook Airだと以下の作業が必要だった。
MacにUSBイーサネットポートを追加する方法

続いてラズパイのIPを特定する
今回は192.168.2.2かな

$ arp -a
? (192.168.2.2) at b8:27:eb:ab:de:b4 on bridge100 ifscope [bridge]
・・・

$ ifconfig
・・・
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether a6:d1:8c:1e:15:64
    inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
    inet6 fe80::a4d1:8cff:fe1e:1564%bridge100 prefixlen 64 scopeid 0xa
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en3 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 9 priority 0 path cost 0
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active

ログイン
初期パスワードはraspberryらしい

$ ssh pi@192.168.2.2
pi@192.168.2.2's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
-bash: warning: setlocale: LC_ALL: cannot change locale (ja_JP.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (ja_JP.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (ja_JP.UTF-8)

// localeなおしておきましょう
$ sudo localedef -f UTF-8 -i ja_JP ja_JP.UTF-8

ログインできた!
Macだけで完結できるの嬉しい!!
img

16
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
20