Get the image
Raspberry Pi Foundation provide “light” versions of the SD card images without a desktop environment for use in server type scenarios directly on their raspbian downloads page.
At the time of the last update to this article the latest version is Raspian Buster Lite.
Download and verify the sha-256 hash and then unzip the archive which should leave you with an image file called something along the lines of
Flash the SD Card
BIG WARNING AND DISCLAIMER
Double and triple check your device names. Running DD with the wrong params can easily destroy entire hard disks worth of data!
dd bs=4M if=2019-09-26-raspbian-buster-lite.img of=/dev/sdd conv=fsync
Etcher is a graphical tool that can make flashing SD cards a bit easier and is available for Windows, Mac and Linux,
Once the flash is complete, my system then recognizes the boot and root partitions and mounts them for me. On my Ubuntu desktop these are mounted at
/media/paul/root. Your systems will vary, and for the rest of these instructions I just use
<root mount point> and
<boot mount point> which you should replace for whatever is appropriate for you.
Create an empty file at
<boot mount point>/ssh. The file does not need to contain anything, it just needs to exist:-
$ touch /media/paul/boot/ssh
Set a static IP address
While the card is still mounted on the machine doing the flash, I edit
<root mount point>/etc/dhcpcd.conf to give it a static IP address. This file is very well commented and the section you want is near the end if the file. You pretty much just have to uncomment the appropriate lines and update the IP, Router and DNS addresses to match your network.
Mine looked like this:-
# Example static IP configuration: interface eth0 static ip_address=192.168.1.41/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.20
Insert the SD card into the Pi and power it up.
During the first boot, Raspbian will automatically detect that the root filesystem is bigger (assuming you have an SD card >2GB) and resize the file system and reboot itself. So give it a few mins before you try to connect.
I like to run
ping 192.168.1.41 and wait for it to start responding to the pings.
Once you are happy it’s booted up and ready, you can connect via SSH with:-
$ ssh email@example.com
The default password is “raspbian” - you should change it!
Configure the hostname
Connect to the Pi via SSH and then run
raspi-config as root:-
$ sudo raspi-config
From the menu’s, choose the networking configuration and then the option to set the hostname. Once done, choose finish and confirm.
The Pi will reboot and when it comes back online it will have it’s new hostname.
Copy your public SSH key
If you have already generated a SSH keypair on your machine, you can copy the public part over to the Pi so you don’t need to enter the password each time you login.
ssh-copy-id is the easiest way to do this, and you would run something like the following.
ssh-copy-id -i ~/.ssh/id_rsa firstname.lastname@example.org