Hardware

How to configure raspberry pi without keyboard or monitor connected (step by step)

Table of contents:

Anonim

This time we bring you a tutorial that can be very interesting. This is how to configure a Raspberry Pi without having a screen or keyboard connected to it. We will do it all remotely! Let's start!

Index of contents

How to install Raspbian OS on Raspberry Pi

  1. Enter the official download page. Choose the newest version of Raspbian and download it.
    1. The version with Desktop has GUI interface. It is recommended for users who are not used to working with text-only interfaces. Lite version has no GUI. When connecting to a monitor we will only see a text interface with which to move around the OS, its filesystem and execute programs just as we would do on a GUI system from the bash console.
    Unzip the.zip file that we have downloaded. Connect the SD card to the PC and make sure what letter of the disk it has.
    1. If the SD has already been used, or just in case, we can format it. For that we download, install and run SDFormatter. We choose the letter of the disk of the SD, and press Format .
    Install Win32 Disk Imager and run the program. Click on the folder button, choose the image of the Raspbian OS that we have unzipped and, after choosing the letter of the SD disk, press Write .

Wifi and SD card connection settings

We will do everything with a Headless configuration, we explain the steps to follow. It is the first thing we should do, and the easiest. Many times we will not have a second screen or the one we will have does not have HDMI. It also happens that we do not have a keyboard and mouse with a USB connection.

This sometimes complicates initial settings, so it is very interesting to be able to configure the OS before putting the SD on the Raspberry Pi. This is called configuring a Raspberry Pi to run Headless , without a screen or keyboard, and we will configure it on our PC before connecting it to anything.

  • We connect the SD to our PC. We check if we can only access the boot disk or folder or we have access to more like etc , usr , lib … Linux and macOS distros should be able to access all the folders, and Windows should not be able to see them. If this is the case, we have to install a program that allows us to mount a disk in the Linux format, such as Paragon ExtFS. Other programs like Ext2fsd do the same but we have not had such a good result.
    • With the open Paragon ExtFS program we connect the SD. This time we will see how the folders that until now we did not have visible as a disk are mounted.
    We go to the boot disk. There we create a file, name it ssh or ssh.txt and leave it empty. With this, the Raspbian OS will activate the SSH connection the next time the system is booted, it will keep it activated and delete the file. On the same boot disk, we put the file where we specify which Wifi network we will use and its information (the name ssid, the key and the key type). After the next system boot , this file will be moved from / boot / to / etc / which is where it should be.

ctrl_interface = DIR = / var / run / wpa_supplicant GROUP = netdev update_config = 1 country = ES network = {ssid = " "psk =" "key_mgmt = WPA-PSK}

Configuring fixed IP

Now we have to configure a static IP, to be able to access the RPi remotely always at the same IP. We open the disk that we have mounted on the pc and open the etc folder to edit the dhcpcd.conf file. What we are doing is editing the /etc/dhcpcd.conf file and adding at the end:

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

DNS configuration

Now we edit /etc/resolv.conf and add the nameserver at the end, which is usually the same as the gateway. Another option is to put the one from google, which is this:

nameserver 8.8.8.8

Latest settings

Now, after ejecting the SD, inserting it into the RPi and plugging in the power, it must be available on our network. To check that it has a connection with other devices, we open a console on our PC (in windows we press the Start button, we type cmd and we press Enter, in macOS in the search engine we write Terminal and in Linux we press Cntrl + T ) and we type ping

If a connection arrives, we download PuTTY on the PC and run it. We write the IP of the RPi in the address bar and press Open . If in the console that opens we receive a response, we write pi and then raspberry . If all went well, we have been successful in setting up our Raspberry Pi in headless mode without ever having to connect it to a screen and keyboard. Congratulations!

Hardware

Editor's choice

Back to top button