Headless Install – Raspberry PI

You can configure your Raspberry PI without having a monitor and keyboard. You can preconfigure the config file for the raspberry PI to boot and make the necessary config.

Note: Because its a headless install if you miss any config you are not going to receive a feedback and yo

u will need to retry/connect to a monitor to see what failed. Hence for Beginners this is a need to know!

https://howtoraspberrypi.com/how-to-raspberry-pi-headless-setup/

Detailed process

In many cases, the solution we want to install on our Raspberry Pi does not require physical access to the Pi, such as an web server, or a Minecraft server. It may happen that we do not have any screen, keyboard, or mouse to control the Raspberry. So you’re going to be thrilled to know that to create a Raspbian system, we do not need any screen or keyboard, and your computer can do the job.

Indeed there is a solution to configure Raspbian on the Raspberry Pi headless, so it can start and connect in Wi-Fi to your Internet network. This method mean you will not use any screen or keyboard to install and configure Raspbian.

Elements required to set up your Pi

In order to make a Raspbian installation on the Raspberry Pi, you will need all the essential elements, a Raspberry Pi 3b , its power supply , and a MicroSD card (8GB is sufficient).

You will also need to download the latest version of Raspbian, which can be downloaded here . We recommend the Lite version because we do not need the GUI. No need to take a coffee break, Raspbian Lite is relatively lightweight and downloads pretty fast. Once the image is downloaded and decompressed, you will have to install it on the SD card, for that we made a detailed article ( here for Windows and there for Linux / Mac ).

Configure the MicroSD card

Now that Raspbian is installed on the SD card, we will be able to configure and modify some files so that the Raspberry Pi can run headless. To do this, we will start by activating SSH on the Raspberry Pi. Remember, the rest of the tutorial is on your PC and not on the Raspberry Pi.

Enable SSH connection

Indeed since the attack that targeted the connected objects in November 2016, the Foundation Raspberry Pi decided to not activate the SSH connections by default. But in order not to block people opting for an installation headless, without screen and without keyboard therefore, the Foundation has put in place a simple and fast solution to activate the SSH. You simply have to create a file named ssh in the boot partition (the file does not expect any extension).We are talking of the boot partition, and not the /boot directory in the main partition of the SD card.

When the Pi is first started, it checks if the file exists and activates the SSH accordingly.

Connect the Raspberry Pi to your Wi-Fi router

The SSH connection is now possible but there is still a step to make the Raspberry usable remotely, headless. Of course, I’m talking about making the connection to the router, which is paramount to using the Pi with SSH.

First, if you want to connect the Raspberry Pi via Ethernet, you can go directly to the next section because no configuration is required.

Here we need a Raspberry Pi 3b or newer.

In order to configure the Wi-Fi connection when starting the Pi, we will create the wpa_supplicant.conf file in the boot partition.

The file must contains the following lines:

country=fr
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid="RouterName"
 psk="Security"
}

In the ssid line , you will replace RouterName with the name of your box, for example , Livebox-5678. For the psk field , this corresponds to the security code of your box, so replace Security by the key of your box. And finally the last line corresponds to the security type of your box, usually WPA.

If you want to know more about the Wi-Fi connection, we have an article about it that you can find by following this link .

Set up a static ip for your Raspberry Pi

This operation require an access to the main partition of the SD card, which mean you need a Linux or Mac OS X computer. If you only have a Windows computer, then connect the raspberry pi, find the ip (for exemple from your router configuration interface), and do the following steps directly on the raspberry via SSH connection.

In order to know the ip that the Raspberry Pi will take, we will give it a static ip. For this we will modify the file dhcpd.conf located in the /etc/folder.

To modify the file, use the same software as to configure the Wi-Fi.

Once in the file, go to the last line and add the following content

eth0 
static ip_address = 192.168.1.100 / 24 
static routers = 192.168.1.1 
static domain_name_servers = 192.168.1.1 

wlan0 interface 
static ip_address = 192.168.1.100 / 24 
static routers = 192.168.1.1 
static domain_name_servers = 192.168.1.1

Let’s take a look at all this, here interface eth0 corresponds to a connection of wired typeand interface wlan0 to a Wi-fi connection . So you have to choose the one that corresponds to your setup.
Static ip_address is used to indicate the ip that your Raspberry Pi will have once started. Generally the ip is of type 192.168.1.x , replace the x with the value of your choice, be careful not to conflict with other devices .

For static router and static domain_name_servers , this is usually the ip of your router, which is 192.168.1.1 .
You only have to save the file.

The SD card is now ready to be inserted into the Raspberry Pi and to start it without a screen and without a keyboard . All you have to do is login SSH to finalize the configuration of the Raspberry Pi (change of passwords, extend the SD card, etc).

Leave a Reply

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