0
3

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.

Raspberry Pi 4 と Raspberry Pi OS をヘッドレスでセットアップ

Last updated at Posted at 2020-10-11

はじめに

Raspberry Pi 用に microSD に OS 書き込んだ後、予め色々設定しておきたい。
毎回やること一緒なのに毎回調べ直しているのでメモる。

少なくとも以下の環境で確認しています。

  • Raspberry Pi 4 Model B (8GB)
  • Samsung EVO Plus 128GB microSDXC UHS-I U3
  • OS の書き込みは Raspberry Pi Imager
    • Raspberry Pi OS Lite

64bit kernel 有効化

boot パーティション内の config.txtarm_64bit=1 を追記する。
追記先は最終行 [all] セクションの中でOK。

SSH 有効化

boot パーティション内に ssh というファイル名(拡張子無し)で空ファイルを配置する。

IPアドレス固定化

rootfs パーティション(Windowsじゃ開けません)の /etc/dhcpcd.conf を書き換える。

有線の場合

interface eth0
static ip_address=192.168.1.20/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254 8.8.8.8

ちなみに電源投入後

SSH接続して初期設定

microSD を差し込んで電源を入れたあとは、PC から PING で疎通確認

(PC) $ ping raspberrypi.local

して、おもむろに SSH 接続( ユーザ名: pi / パスワード: raspberry )

(PC) $ ssh pi@raspberrypi.local

して、適当に初期設定する。

(RPi) $ sudo raspi-config

ロケール設定

Can't set locale; make sure $LC_* and $LANG are correct!

スワップ無効化

$ sudo swapoff --all
$ sudo apt remove dphys-swapfile

ファームウェア確認

$ sudo rpi-eeprom-update

アップデート

$ sudo apt update
$ sudo apt full-upgrade
$ sudo apt-get autoremove
$ sudo apt-get autoclean
0
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?