DEV Community

Cover image for Setting up headless Raspberry Pi
cycool29
cycool29

Posted on • Updated on • Originally published at cycool29.github.io

Setting up headless Raspberry Pi


Table of Contents


You may just want to use your Raspberry Pi as a low-cost Linux computer.

However, you will need a monitor, keyboard, mouse... etc. This will be associated with a huge amount of money (that's not low-cost anymore...). πŸ’°

But, You may use a headless setup for your Pi to cut down all the cost. 😎

What is headless setup? πŸ€”

A headless setup is the Raspberry Pi minus the monitor, keyboard, and mouse. Running a headless setup lets us forego the extra peripherals and directly control the Raspberry Pi wirelessly from any other PC in local network.

In this tutorial, you need to install Raspberry Pi Imager, Angry IP Scanner and RealVNC Viewer.

RPI Imager

Angry IP Scanner

RealVNC Viewer

Install OS to your SD card ⏬

Your Raspberry Pi needs an operating system to work. If your SD card is not arrived with Raspberry Pi OS or NOOBS pre-installed, you will need to install an operating system into it first.

Insert your SD card into the SD card slot or SD card reader of your external PC.

Open Raspberry Pi Imager. You will use this tool to flash OS to your SD Card.

Raspberry Pi Imager

Click CHOOSE OS.

Choose OS

Choose any OS you want to install on your Raspberry Pi.

Choose OS

Choose OS

Click CHOOSE STORAGE.

Choose Storage

Choose the SD card you want to flash to your Raspberry Pi.

Choose Storage

Now, press Ctrl + Shift + X. This will open an Advanced options dialog.

Toggle on Enable SSH and Use password authentication.

Create a login password for your Raspberry Pi and fill it in the Set password for the 'pi' user . You must remember it as we will need this password later for SSH login.

If you are going to use WiFi for your Raspberry Pi's connection, toggle on Configure wifi and configure your WiFi settings there.

Lastly, check Set locale settings. Choose your Time zone and Keyboard layout there and click Save.

Advanced options

Check all configurations are correct and click Write. This will start writing the Raspberry Pi OS to the chosen SD Card. It might take a while so you may have a coffee break.

Writing image to SD card

Verifying image is writen to SD card

  1. Now you have flashed an OS to your SD card. Safely unmount it and plug it into Raspberry Pi's SD card slot.

Flash done

Enable VNC in your Raspberry Pi βœ…

Connect your Raspberry Pi to power source.

Launch Angry IP Scanner.

Click Start to discover your Raspberry Pi.

You should see a list of IP addresses after scanning. Find raspberrypi or raspberrypi.local and note down the IP address.

Ipscan scan result

Exit Angry IP Scanner.

If you are on Windows, you will need to enable OpenSSH first.

  • Open Settings, select Apps > Apps & Features, then select Optional Features.
  • Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select Add a feature, then: Find OpenSSH Client, then click Install.

Open a terminal window on your PC replacing <IP> with the IP address of the Raspberry Pi you’re trying to connect to.

ssh pi@<IP>
Enter fullscreen mode Exit fullscreen mode

When the connection works you will see a security/authenticity warning. Type yes to continue. You will only see this warning the first time you connect.

You will be prompted for the password for the pi login, enter the password you set just now in Raspberry Pi Imager.

Now you should see something like this:

pi@raspberrypi ~ $
Enter fullscreen mode Exit fullscreen mode

Now you can execute commands on your Pi. But there is no graphical desktop, yet.

Enter sudo raspi-config.

Do the following to enable VNC:

  • Navigate to Interfacing Options.
  • Scroll down and select VNC > Yes.

Raspi-config VNC

Now you have enabled VNC on your Raspberry Pi. Close the SSH session by entering exit or just simply close the terminal window.

Connect VNC to your Raspberry Pi πŸ”—

Launch RealVNC Viewer.

Select File > New connection.

Enter the IP address of your Raspberry Pi in VNC Server field and give it a name in Name field.

VNC property

Leave all other options default and click OK.

Right click at the property you just added and select Connect

VNC connecting

If it prompts you this window, simply click Continue.

VNC warning

Fill pi in the Username field and your Raspberry Pi's password in the Password field.

VNC username password

Click OK.

Finally, you will be presented with your Raspberry Pi desktop!

VNC desktop

Thanks for reading!

BTW, today is the 10th anniversary of Raspberry Pi!
Wish happy birthday to them in the comment box! πŸŽ‚


If you find this article helpful, consider buying me a coffee!

ko-fi

Discussion (0)