Raspberry Pi ヘッドレス・セットアップについて

Raspberry Pi

はじめに

Raspberry Piをディスプレイやキーボード及びマウスを接続することなく、初期設定等を行いたい場合があるかと思います。
ここでは、sshを使用したヘッドレス・セットアップ方法について記載いたします。

環境

  • ボード
    Raspberry Pi 4 Model B
  • OS
    Raspberry Pi OS (32-bit) Lite
    Minimal image based on Debian Buster
    Version: August 2020
    Release date: 2020-08-20
    Kernel version: 5.4

ssh有効化

raspbian-jessie(2016/11/25版)からインストールイメージの初期設定では、SSHが無効になっていますので、有効化する必要があります。
以下の記載のとおり、PCを使用してSDカードのbootパーティションに「ssh」という名前のファイルを作成すれば、起動時にsshが有効化されます。ファイルの中身は空で問題はありません。
(注:拡張子はつけてはいけませんので、注意してください。)

3. Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter; it could contain text, or nothing at all.

If you have loaded Raspberry Pi OS onto a blank SD card, you will have two partitions. The first one, which is the smaller one, is the boot partition. Place the file into this one.

Raspberry Pi Documentation公式ページより抜粋

IPアドレスの確認

Raspberry PiをLANケーブルで接続した後、電源を接続し起動します。
初期設定ではIPアドレスを自動取得する設定になっています。
DHCPに対応しているネットワーク環境であれば、自動でIPアドレスが割り当てられます。
ブロードバンドルータを使用されている場合、一般的にDHCPサーバ機能を有していますので、ブロードバンドルータの管理画面からDHCPサーバのIPアドレス払い出し状況を確認し、Raspberry Piに割り当てられたIPアドレスを確認します。
(※B8:27:EB:XX:XXのMACアドレスがRaspberry PiのMACアドレスです。)

Raspberry Piとの接続

IPアドレスの確認ができれば、TeraTerm等を使用してsshで接続します。
初期の「ユーザID/パスワード」は、「pi/raspberry」です。

タイトルとURLをコピーしました