Robert Guiscard
2 min readOct 24, 2018

Setup headless Raspberry Pi 3 model B+

Here I will set up Raspberry Pi in headless mode so that I can control it through ssh without monitor, keyboard and mouse attached on it.

The first thing to do is to write Raspberry Pi operating system to a SD card. While it is recommended to use NOOBS for beginners, NOOBS use graphic interface which cannot be displayed in headless mode. Thus, I will go for Raspbian, which is a version of debian running on Raspberry Pi.

Insert SD card into computer and use Etcher to burn Raspbian on it. Raspbian comes with a desktop version and a lite version. Desktop version contains a graphic user interface which might be handy in the future. If you are absolutely sure you will not use graphic user interface, namely X Window System, you can use lite version.

Once the image is burned, go to root directory in the SD card.

To enable ssh, do

touch ssh

It will create a file named ssh under root directory.

Then add another file called wpa_supplicant.conf under root directory as

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid="wifi ssid"
psk="wifi password"
}

Reject SD card from computer and insert it into Raspberry Pi board. Connect power onto mini USB port of Raspberry Pi board.

Once it is powered, a red light will show up on side of Raspberry Pi board. Green light indicates reading of SD card.

You can ssh onto it by

ssh pi@raspberrypi.local

And the default password is raspberry. The domain name raspberrypi.local is mDNS name, which is supported by most modern OS.

If you have difficulty in getting Raspberry Pi connected through mDNS, probably from Windows, you can try to find the ip through your mobile phone. It is easier than most command-line tool.

Once you are in, use raspi-config to permanently enable ssh by

sudo raspi-config

Choose Interfacing Options, then enable ssh.

You should also change your password by

passwd

To reboot:

sudo reboot

And shutdown:

sudo halt

You can also protect your password by using wpa_passpharase to replace clear text password in /etc/wpa_supplicant/wpa_supplicant.conf

wpa_passphrase wifi_ssid

It will ask password. Then copy and paste the calculated psk onto network section without the quotation.

You can also enable VNC server on Raspberry Pi by

sudo raspi-config

Choose Interfacing Options, then enable vnc. Then find a VNC viewer to connect to it.

Finally, update softwares by

sudo apt-get update
sudo apt-get dist-upgrade

You should also learn how to secure Raspberry Pi if you plan to use it as a server.

It is also common to generate new ssh key like this:

ssh-keygen -t rsa -b 4096 -C "your@email.address"

No responses yet