Select Page

Setup a Headless Raspberry Pi Server


So you’ve bought a Raspberry Pi and want to start using it for the 101 awesome projects you’ve got lined up, but you don’t have a spare keyboard or monitor. How do you go about setting it up in a totally headless environment?

This is a very quick guide to setting up a headless Raspberry Pi that will automatically join your network and let you SSH in with a fresh install of Raspbian.

A lot of the Raspberry Pi tutorials will use this method as it’s a good starting point for any project.

Software Required

  • Etcher – Disc Imager.
  • Putty – SSH Client.


Technical Jargon

IP Address (IP)

An IP address is a unique (numeral) address that is used to identify a device on the network. Every computer has an IP address and these are used by computers to talk to one another.

Think of it like your postal address or telephone number. If someone wants to contact you they use your unique address, this is the same for a computer and its IP.

Click here for a full detailed description of IP address.


A computer hostname is similar to you wearing a name badge. Computers can be known by their unique IP address, or a nick name (hostname) can be assigned to them. The hostname is the easy to remember name of a computer and like the IP address must be unique on the network.

Click here for a full detailed description of computer hostnames.


DHCP stands for Dynamic Host Configuration Protocol and a DHCP server is the server tasked with giving computers without an IP address their address. It is similar to going to the theater and the box office assigning you a seat. They make a note of your seat row and number so if you’re needed during the performance someone can find you. This is the same job the DHCP server has, it gives computer A an IP address and then gives that address to the DNS server so when other computers want to find computer A they are told where they can find them.

A server usually has a range of IP addresses it is allowed to hand out. E.g. To If you are using a static IP address you’ll want to pick one outside of the range.

Click here for a full detailed description of DHCP.


DNS  stands for Domain Name System. A DNS server is like an old fashioned address book. It holds all of the hostnames and IP addresses of computers on the network so when we want to talk to Computer A we can ask the DNS server for their address and they will find it for us. Once found we can then go and contact Computer A.

Click here for a full detailed description of DNS.


SSH stands for secure shell. SSH is an encrypted connection established between two computer programs. On the server side (the computer being connected to) a service is running that listens for another computer trying to contact it via SSH.

Click here for a full detailed description of SSH.

How to Install Raspbian on a Headless Server

Installing Raspbian is easy, you’re going to:

  • Download Raspbian.
  • Write the Raspian image to a microSD.
  • Power on the Raspberry Pi.
  • SSH into the Raspberry Pi.
  • Configure basic settings.

For this process we’re going to need the following hardware:

  • 1 x Raspberry Pi.
  • 1 x microSD card (Recommended at least 8GB, or to suit for the project).
  • 1 x microSD card reader.

And the following software:

Download Raspbian

 Now we’re ready to start, grab the latest version of Raspbian from the Raspberry Pi Foundation’s website.

For most of my work I use Raspbian Stretch Lite as I very rarely have a need for a user interface. Getting the lite version will provide minimal packages and just a command line.

If you chose to “Download Zip”, now might be a good time to grab a cup of tea as the download speeds from The Raspberry Pi Foundation aren’t the best.

Unzip the File

Raspbian is provided as a compassed disk image and will need unzipping before it can be written to the microSD card.

If you’re on Windows 10, right clicking and selecting “Extract All…” should do the trick, but if you run into any problems the following programs are recommended by the Raspberry Pi Foundation:

Write Raspbian to microSD

 Writing the Raspbian image to a microSD card is a straightforward process. In this guide we’ll be using balenaEtcher.

With Etcher you’ll need to select an image and flash the disc. If you have just a single drive connected to your computer it will be automatically selected, otherwise you’ll need an extra step to select the drive. Depending on the speed of the microSD card chosen, it can take a few minutes to write the image to disc.

CAUTION ensure the correct drive is selected. Selecting the wrong drive will result in losing all data on the selected drive.

First off, open balenaEtcher.

Click “Select image” to continue.

In file explorer navigate to your unzipped copy of Raspbian, select it and then click “Open”.

Ensuring the correct removable drive has been selected click “Flash!”.

This window will be displayed and the progress of the flash will be shown.

Enable SSH

By default Rasbian disables SSH access. We will need to enable SSH to do anything as there won’t be a keyboard, mouse or monitor attached to the Raspberry Pi.

To enable SSH open the newly flashed microSD card and create a file called “ssh”.

My drive has been identified as “boot (D:)”. View the contents of the drive then right click and choose “New”, then “Text Document” and finally name it “ssh”.

By default it will have a .txt extension, this needs to be removed and select “Yes” to being sure you want to change the filename extension.

The file named ssh tells Raspbian to enable SSH access when it boots.

Click Yes to accept the change of filename extension and to create the file.

Enable WiFi

If the Raspberry Pi will not be connected to an Ethernet connection and is going to be totally headless you’ll need to configure the WiFi options before removing the microSD card from the computer.

In the same way you created a file called “ssh”, in the root directory of the D: drive create a file called “wpa_supplicant.conf”.

Once created open it in a text editor and paste the below text, modifying as necessary. 

Your ISO Country Code should be updated, for example GB for United Kingdom:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Save your changes and close the text editor.

Boot up the Raspberry Pi

Now that the disc image has been written and necessary files have been created and edited eject the micorSD card and place it into the Raspberry Pi. Plug in the necessary cables,  Ethernet (if needed) and power and watch the Pi come to life!

The default username is: pi

The default password is: raspberry

By default the Raspberry Pi will be assigned an IP by the DHCP server so it’s IP address can be found by interrogating whichever device provides IPs.

SSH into Your Pi

In this guide I’m using the Putty SSH Client to ssh into my Raspbery Pi. Open putty and ensure it is using port 22. In the Host Name (or IP address) type in the IP address found from the DHCP server. If your DHCP server uses hostnames, typing raspberry.*domain* will work as well. E.g. raspberry.local.lan.

Once the correct hostname or IP address are in the box click “Open” to start a connection to the Raspberry Pi. If successful a black window with login prompt will appear where you’ll want to ender “pi” for the username and “raspberry” for the password. Hit return after each command.

Ater successfully login in you will be greeted with a similar window. I use Ethernet to connect my Raspberry Pis to my network, hence the WiFi disabled message.

Update and Configure

Once logged into the Raspberry Pi you’ll want to ensure it’s using the latest software and is configured to use another password other than the default.

First you’ll want to update the package lists:

sudo apt-get update

Once using the latest packages you’ll want to update your software The “-y” automatically selects “yes” to confirmation messages:

sudo apt-get upgrade -y

Now the system is up to date, let’s change the default password:

sudo raspi-config

raspi-conig allows you to update some basic settings from an easy to understand menu. For this part we are just updating the user password.

Ensure “1 Change User Password” is selected and then hit return. On the next page that explains the process hit return again before being taken to enter your password twice. If the passwords match you’ll be prompted with a success screen. Make sure to chose a passwod that isn’t easily guessed but you can remember!

Next we’re going to set a new hostname, use the arrow keys to select “2 Network Options” and press return. On the next page “N1 Hostname” will be highlighted, hit return again, make sure to read and understand to next page before pressing return for the final time. Once you are prompted with “Please enter a hostname” delete the default “raspberrypi” and replace it with something that will be meaningful to your project. Once you’re happy hit return to accept and go back to the main page.

Finally in the raspi-config page we’re going to expand the file storage to make sure the Raspberry Pi has access to the entire microSD card. Use the arrow keys to select “7 Advanced Options”, press return and then return again on “A1 Expand Filesystem”. This will automatically expand the file system.

To close raspi-config press the right direction arrow to highlight “Select” then press once more to highlight “Finished” and hit return. You should be asked if you want to restart now, you should say “Yes” to this, otherwise you’ll then be taken back to the console.


Now you’re finished setting up and configuring the basics of your Raspberry Pi. What are you waiting for? Get on and do something great!



Submit a Comment

Your email address will not be published. Required fields are marked *