0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MacでRraspberry Pi 4の初期セットアップ(SSH接続まで)

Posted at

Raspberry Piにティスプレイ、キーボード、マウス、LANケーブル等を接続せず、0状態からSSHで制御したかったので方法を調べました。
ほぼ同じ目的で記事を書いている方がいて大変助かりましたが、自分の環境依存な箇所もあったのでメモがてら記録しておきます。

利用環境

  • Mac(Big Sur)
  • Raspberry Pi 4 Model B(4G)

OSの準備

スターターキットを買ったので付属のmicroSDを刺すだけで動くはずでしたが、何かおかしいので結局0ベースでインストールしました。
めんどうそう・・・と思っていましが、なんと「Raspberry Pi Imager」なる専用ソフトがリリースされているではありませんか!

特に迷いもなく、インストール・利用できました。最初に一旦「Erase」するのがいいみたいです。
OSはRecommendedとなっているRaspberry Pi OS(32bit)を選択しました。

時間帯によってダウンロードに時間がかかる場合もあるようですが、私の環境だとインストール+Writeに15分くらいでした。

スクリーンショット 2021-02-17 8.01.28.png

OSの初期設定(SSH許可やWi-Fi設定)

OSにログインしない状態でどう設定するのだろう?と思っていましたが、普通にmicroSDカードをMacに挿して(アダプタ必要)直接ファイルをいじればいいとのことです。

SSHの許可

touch /Volumes/boot/ssh

Wi-Fiの設定

touch /Volumes/boot/wpa_supplicant.conf
country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="ssid_name"
    psk="password"
}

Raspberry PiのブートでSSHでのログイン

起動

電源ケーブル刺すだけです。緑のLEDのチカチカが止まればbootしてるっぽいです。1分弱くらいのイメージ。

ログイン

Mac環境ではmDNSにより、IP知らずとも以下でログインできるみたいです。

ssh pi@raspberrypi.local

mDNSで名前が解決できない場合はIPアドレスを調べます。
arp -aとかで、それっぽいのを見つければいいのですが、Raspberry Pi 4ではdc:a6:32:xx:xx:xxからはじまるMacアドレスがRaspberry Piらしいです。

3のときはb8:27:eb:xx.xx.xxだったらしいです。

arp -a

? (192.168.0.39) at 92:af:b5:40:a9:d0 on en1 ifscope [ethernet]
? (192.168.0.40) at 92:8d:40:6b:68:d4 on en1 ifscope [ethernet]
? (192.168.0.42) at 1e:71:39:26:b9:58 on en1 ifscope [ethernet]
? (192.168.0.46) at dc:a6:32:93:b7:c5 on en1 ifscope [ethernet]
? (192.168.0.255) at ff:ff:ff:ff:ff:ff on en1 ifscope [ethernet]

ここでは192.168.0.46がRespberry Piみたい。
無事ログインできました。

pi@raspberrypi:~ $

あとはいじるだけ。

0
4
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
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?