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
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).
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).
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
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:
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:
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 }
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.:
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)
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