Benutzer-Werkzeuge

Webseiten-Werkzeuge


public:headless-inst

Customized RaspberryPi headless installation

Headless1)

NOTE: If all of this seems wierd to you and you are looking for something more convenient, like colored window clicking, please consider using the RaspiImager for all tasks mentioned below.

Since I had been doing this for a quite a while and the early days of RaspberryPi were not as convenient in usage as they are today, I had to find ways that I kept until today.

Here you go:
Click on code to copy to clipboard

Chosse your flavor

RaspberryPi Software appropriate for your device version (RasPi 2, 3/3B or 4)
RaspberryPi OS ( *-lite versions recommended )

Unzip the downloaded file, to obtain the *.img file needed.
Also, please note that, if you intend to make use of a monitor, keyboard and desktop software after installation,
the following steps don't really make sense for your purpose (please consider using the default installation methods provided here).

Write image to SD card or USB stick

USB stick2)
Note: Please refer to your searchengine of trust how to write an image file to SD card or USB stick according to your OS.

If you use Linux, simply do it using dd in a terminal and sync all discs after writing:
e.g.:

sudo dd bs=4M if=/path/to/your/pi-image of=/path/to/your/media; sync 

Insert the prepared media to your card reader (or USB slot).
Note: Not neccessary with Linux, media should be recongnized after syncing (else mount it manually).

Enable SSH server at initial boot


Once done, create an empty file named ssh at the /boot/ partition of the SD card (or USB stick).
e.g.:

touch /media/<your-user>/boot/ssh



Configure WiFi client at initial boot

NOTE: This feature is DEPRECATED since „bookworm“


You can copy/create a file named wpa_supplicant.conf to the boot partion and configure your own WiFi (client) at initial boot:

wpa__supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=<Insert 2 letter ISO 3166-1 country code here>
update_config=1

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}

Note: ISO 3166-1: Germany = DE | France = FR | Netherlands = NL | United Kindom = UK | United States = US etc..

More advanced for hidden WPA2 WiFi:

wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>

network={
        scan_ssid=1
        ssid="<Name of your wireless LAN>"
        psk="<Password for your wireless LAN>"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}



Create and configure your own user/password at initial boot


Note: Default user/password : pi / raspberry

Use a Linux terminal and type:

openssl passwd -6


you will be asked to type (and verify) your desired password and get a similar output like this:

user@machine:~$ openssl passwd -6
Password: 
Verifying - Password: 
$6$AHCtZWf4DRTCTZXw$2S8OawPAulDrFp/wUm8VK3ZSW5xbc2cnILEEiVgA1RVE6TmznLdMB32wCSdNcG.Gzs/omkp6jg2V5BtGuC0.y0


Now you can generate a file named userconf.txt containing username:hashed-password in the boot partition.
e.g.:

userconf.txt
username:$6$AHCtZWf4DRTCTZXw$2S8OawPAulDrFp/wUm8VK3ZSW5xbc2cnILEEiVgA1RVE6TmznLdMB32wCSdNcG.Gzs/omkp6jg2V5BtGuC0.y0

Note: Incase you just copied and used the file provided here, the generated password is: mypassword (and should be changed ASAP) 8-)

Boot your RaspberryPi


Finally insert the prepared media into your RaspberryPi and power it up.
Find out which IP address your device obtained (WiFi or ethernet, whatever connected), by looking into the lease table of your DHCP server or scanning your network.
e.g.:

nmap your.sub.net.here/prefix

Connect to your RaspberryPi with ssh (linux/mac in a terminal) or using KiTTY or PuTTY for Windows with configured username and the password set.
e.g.:

ssh username@IP.of.your.RasPi

Accept the saving of the SSH host key and log in to your device.

Here is another link that I personally find a very interesting project:
https://raspi.debian.net/

Enjoy!

References:
https://www.raspberrypi.com/documentation/computers/configuration.html#setting-up-a-headless-raspberry-pi

1)
no monitor, no keyboard
2)
RaspberryPi v4 only
public/headless-inst.txt · Zuletzt geändert: 2024/03/26 09:28 von gerson

Seiten-Werkzeuge