Headless installation of a Raspberry Pi
Prerequisites
- MicroSD card of at least 8GB.
- Image of Raspbian, downloadable from https://www.raspberrypi.com/software/operating-systems/.
Image dump
Once the microSD card is inserted into the PC, we check the device name:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 119.1G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /media/bootfs
└─mmcblk0p2 179:2 0 118.8G 0 part /media/rootfs
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 488M 0 part /boot
└─nvme0n1p3 259:3 0 1.8T 0 part
└─nvme0n1p3_crypt 253:0 0 1.8T 0 crypt
├─vg-root 253:1 0 117.9G 0 lvm /
├─vg-swap_1 253:2 0 976M 0 lvm [SWAP]
└─vg-home 253:3 0 1.7T 0 lvm /home
nvme1n1 259:4 0 1.8T 0 disk
└─nvme1n1p1 259:5 0 1.8T 0 part
Now we unzip the downloaded image:
xz --decompress 2022-04-04-raspios-bullseye-arm64-lite.img.xz
We save the image on the card:
sudo dd if=2022-04-04-raspios-bullseye-arm64-lite.img of=/dev/mmcblk0 bs=1M status=progress
Enable SSH access
Create a file named ssh
in the root of the boot partition of the card.
Wireless configuration
Edit the file /etc/wpa_supplicant/wpa_supplicant.conf
, entering the configuration of the wireless network to which it will connect:
country=<country code>
crtl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid="<network name>"
psk="<password>"
}
All that remains is to remove the card, insert it into the Raspberry and boot. From this moment on we will be able to connect to it using the name raspberrypi or rasberrypi.local.