Running A Headless Raspberry Pi
Tags: raspberrypi, tutorial, linux, beginners
Published: 2023-12-31 19:53:00

Imagine having a Raspberry Pi, a tiny computer that fits in your palm, running smoothly without the need for a monitor, keyboard, or mouse. This is what we call running a headless Raspberry Pi: a setup where the Pi operates without a traditional display and input devices. It might sound a bit techy, but it's simpler than you think.
In this article, we'll walk through the basics of running your Raspberry Pi headlessly, unlocking its potential without the clutter of additional peripherals.

##**Aside**
I recently got a Raspberry Pi from a friend and many things have been flooding my mind on what to use it for:
- Perhaps If I add another Raspberry Pi I could run a Kubernetes Cluster
- Practice my Linux skills
- Use it for some home automation ideas in the future.

Even though I have Ubuntu Linux running on my Windows machine, I still need the feel of a standalone Linux machine and my tiny raspberry pi cuts it for me.
Anyway, let's get to it.
These are the list of things I will be working with:

- Raspberry Pi 3 Model B
- SD card
- A private Wifi network
- [Raspberry Pi Imager](https://www.raspberrypi.com/software/)
- [RealVNC viewer](https://www.realvnc.com/en/connect/download/viewer)
- [Putty](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)

**Note**:
I recommend you install the recommended software on your machine before we start.

## Overview

In summary, we are going to perform 9 steps:

1. Insert Or connect our SD card to our computer
2. Format the SD  card
3. Selecting the Device and operating system in the Raspberry Pi Imager
4. Configure settings for our Raspberry Pi Os
5. Download Raspberry PI OS to our SD card
6. Insert Our Sd card into the Raspberry PI
7. Connect the Raspberry Pi to a power source
8. Remotely SSH into the Raspberry PI over a Wi-Fi network
9. Use RealVNC viewer to Remotely access the Raspberry PI over a Wi-Fi network

## About Raspberry PI

According to [Wikipedia](https://en.wikipedia.org/wiki/Raspberry_Pi), Raspberry Pi is a series of small single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in association with Broadcom.
In summary, they say that a Raspberry Pi is a small computer that has all the Storage and memory (RAM) on a single and small board.
As earlier stated, I will be using a Raspberry Pi 3 model B with 1 gigabyte of Random Access Memory(RAM) and 8 gigabytes SD card for storage
First connect your SD card to your computer, if your machine has an SD card slot like mine then you may just slide it in else you should get an SD card adapter.
Launch the Raspberry Pi Imager and you’ll get to see the below screen:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jh655uqsw1c1bkvpslur.png)

Next, you will get to choose your Raspberry Pi device, go ahead and choose your device

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yogpfzgbcmbew6nlkrv9.png)

In my case, I selected Raspberry Pi 3 as my option. You can see that it has all the submodels under it.
Go ahead and choose the Operating system(OS)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyhn4w9oetn5jgdsg3hq.png)

Next, click on Choose Storage and select your SD card as the storage

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7aoihvc7p499c5lf5uk.png)

You may now click on the Next button.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mpk34fl23a7n3d30eyvr.png)

At the click of the Next button, you’ll be prompted  with the OS Customisation menu as below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x41bavyhgc3cxcpm6f5f.png)

Under the OS customization menu are 3 tabs

- General
- Services
- Options

First, the General tab provides a way to set our hostname for the Raspberry Pi and set username and password. Under Configure wireless LAN, Add your Wifi network name and password. Also choose your country under Wireless LAN country, in my case, I selected NG which is the symbol for Nigeria.
Next, under Set locale settings, choose your timezone and keyboard layout.
Move to the services tab:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9xomt0mitd5xinrw3qo.png)

Under the services tab, enable SSH(Secure Shell). This is very important as it will allow us to communicate with this device over the Wifi network through the terminal. Also, choose password authentication.
Done with the services tab, move to the Options tab:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9hbl9phgsq8m71xvpwqd.png)

Just as the name suggests, The Options tab is optional, but for me, I need my machine to play sound when it is finished downloading the OS. I also need it to automatically eject the SD card when completed and also enable telemetry which provides  OS downloads data to Raspberry.
When done, click on the Save button and you will be presented with the confirmation screen below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ow4io11rsppse2wkjcaj.png)

Click Yes.

You’ll then be prompted to confirm if you want to do this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8pu12zqybkh2c7sd81xf.png)

Since you are sure of what you are doing, click Yes.

If everything goes well, you should see the below output:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39jc9xl20xgr4m3m2bl4.png)

If you are getting the “Please insert a disk into ..” error like the below output

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfx1mtjfu4fzabu0kjuh.png)

This little [**SD formatter tool**](https://www.sdcard.org/downloads/formatter/) should fix the issue.

After some time, the download will start:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/co8frfuu7w9ru3tyv03r.png)

If you chose the Eject media option, your SD card will be automatically ejected when installation is completed. If you did not, you will have to eject it yourself manually.
Next, we will run the Raspberry OS on our Raspberry PI.

## Getting Raspberry Pi Running

Insert the SD card card into your Raspberry PI and plug in the power cable.
After some seconds your Raspberry PI should be up and running.
We need to find a way to communicate with this device.
Remember we had a wifi network as one of the things you’ll need in this tutorial? 
Get your Raspberry Pi and your machine on the same Wifi network you configured in Os customization for the Raspberry Pi.
After you have them both connected to the same network, under 
This is the time that we bring in one Putty. Putty is an SSH client that will let us communicate with our Raspberry Pi on the Wifi network using its IP address.
Open your Wifi router menu and copy the IP address of the Raspberry Pi on the network. Open Putty and paste the IP address like so:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gt49nigke485706l3juf.png)

Click on open.

You will be prompted to enter your username and password. If the login is successful, you should see a screen similar to below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4yhqzb1bd2e58di44ul.png)

Hurray, we are in.
We can use our tiny computer from here(command line) or even take it further and get a graphical user interface(GUI) from it.
To achieve this we need [**Virtual Network Computing**](https://web.mit.edu/cdsdev/src/howitworks.html)(VNC) software. VNC is a remote access technology that enables computers to access and take control of another computer.
In this tutorial, we will be using a type of VNC called RealVNC viewer. 
RealVNC comes in 2 parts: RealVNC viewer that we have installed on our machine and RealVNC Server that talks to us from the computer we want to access.
We have to get into our tiny machine and enable the RealVNC Server.
In the Putty terminal run the command below:

```bash
sudo raspi-config
```
On running the above command, you’ll be shown the screen below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v1hqgv6w4fiuoerq7al.png)

What is of particular interest to us is the Interface Options. Navigate to the Interface Options using the arrow down key and press enter when you are there.
This gets you to the screen below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n83rzzslt16rcsxvc4fu.png)

Use the down arrow key to scroll to VNC and hit enter

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7iqm4is5kij7ga08yg6k.png)

Use the left and right arrow keys to toggle between Yes and No. Toggle it to Yes and press the enter key.
It shows that the RealVNC server is enabled by showing the following output

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9n54jfw80m72ip66xgy.png)

Click on enter and use the right arrow key to navigate to finish. Then press enter.
RealVNC Server is now ready to talk to our machine.

## Accessing Raspberry Pi through RealVNC viewer(Desktop)

Open RealVNC viewer, click on the file tab then “new connection”.
The below output is what you should see next.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1i427f3x70ix8exa68f.png)

Copy and paste the Raspberry Pi IP address to the “VNC Server” then click OK.
Right-click on the monitor icon and click connect
It will ask for your RealVNC username and password, supply it and 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rnjpkbizk18ivtea67a.png)

Click Ok

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9tgqbffwf72i1ufs0hhn.png)

You may play around with it, ensure you shut it down before you unplug the power cable.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6p111lmp05302efh7srv.png)

## Accessing Raspberry Pi through RVNC viewer(Mobile)

It is also possible to remotely access the Raspberry Pi with your smartphone.
To achieve this, search and install RVNC viewer on Google Play Store for Android or App Store for iOS.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9qfe0toqaz7ebde8cov.jpg)

Click on the **+** button 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7usi6hss4u3jrhn2z3o.jpg)

Next, input your Raspberry Pi IP address and click Create.
You will be presented with the below screen

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzqv4o4h7z6x0eb5oe8e.jpg)

Click on “Connect” 
Add your username and password and click “Continue”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mwhv48mmxxtumyvxbw3l.jpg)
Behold your Raspberry PI on mobile
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1uru8iochg8ylsvetzf.jpg)

## Conclusion
Running a headless Raspberry Pi offers an efficient way to use this versatile mini-computer. By eliminating the need for monitor and input devices, you not only save space but also open up possibilities for various projects and applications.