In this post I will explain how to install Raspbian (the operating system) on a Raspberry Pi. We will use Raspbian as a base to later install Jeedom.
What do we need
- Raspberry Pi
- Micro SD card of at least 16GB and class 10
- Card reader or adapter to connect the card to the computer
- A computer (Windows, Linux o macOS)
Install Raspbian with Raspberry Pi Imager
The first thing we will do is download the Raspberry PI Imager software from the download section of the Raspberry PI page and install it on the computer.
Next we will connect the micro SD card to the computer and launch the Raspberry Pi Imager and the following window will appear.
We will click on the CHOOSE OS button and select the operating system that we want to install, in this case Raspberry Pi OS or Raspberry Pi OS Lite if we do not want to install the graphical environment (the latter is inside Raspberry Pi OS (other)).
I have chosen the lite version since I do not plan to use the graphical environment.
Next we will click on the CHOOSE STORAGE button and select the micro SD card on which we want to install Raspbian.
Once this is done, the WRITE button will be available, we will click on this button and at that moment the download of the operating system and the installation on the micro SD card will begin, so we will have to wait for the installation to finish. When the installation is finished a new window will appear.
With this we finish the installation of the operating system on the micro SD card, now we will need to configure some things on the Raspberry Pi.
Enabling SSH (remote access) on the Raspberry Pi
To avoid having to use a monitor and a keyboard every time we have to operate on our Raspberry Pi, we must enable SSH access.
The process is very simple, we will open the boot partition or hard drive and create an empty file called SSH WITHOUT ANY EXTENSION (in Windows it is necessary to disable the Hide file extensions for known file types checkbox within the fille explorer options).
If boot is not visible we just disconnect the SD card from the computer and reconnect it.
Connect to the Raspberry Pi remotely
Once the above is finished, we can mount the micro SD card on our Raspberry Pi, connect it with a network cable and turn it on.
The first thing we will do is connect to our router and find the IP address of the Raspberry Pi; in my case the address is 192.168.20.11
By default, the router will assign a dynamic IP address to the Raspberry Pi and this means that it can change over time or if we turn off or restart the Raspberry Pi.
This would cause connection problems between the Raspberry Pi and other devices that it communicates with over our network and it would also be a problem to connect remotely.
To avoid this we have two options:
- Assign a fixed IP in the router for our Raspberry Pi (it is my preferred method): In each router it is configured differently but it is usually found within the DHCP or DHCP Binding section
- Configure a static IP in Raspbian: I will explain how to do this later
Once we have the IP of our Raspberry Pi we can connect to it by SSH, I use a free program called PuTTY that can be downloaded here.
In PuTTY we will type the IP address of our Raspberry Pi and press the Open button.
If all goes well, a new window will appear where it will ask for the username and password. The default user is pi with the password raspberry.
After filling in this information we will be connected to our Raspberry Pi and we will see a couple of messages that we should solve:
- Change the default password of the pi user
- The Wifi connection is disabled
Change password of the pi user
We will simply execute the
passwd command and it will ask us for the current password and the new password.
Activate Wifi and other settings
We will execute the
sudo raspi-config command and a window will appear with different configuration options:
It is best to research what is inside each menu and adjust what each one needs. Some interesting settings are:
- System Options:
- Wireless LAN: Here we can activate and configure the Wifi connection
- Hostname: Here we can define the name that other devices on our network will see
- Interface Options: Here we can activate different connections and interfaces of the Raspberry Pi
- Localisation Options: Here we can adjust regional settings and time zone
- Advanced Options:
- Expand filesystem: With this, we make sure that all the space on the SD is used. I recommend executing this option; It will be necessary to restart the Raspberry Pi
Assign static IP in Raspberry Pi configuration
If you prefer, you can also assign a fixed IP to the Raspberry Pi in the configuration instead of doing it in the router, the disadvantage of this method is that if we have to make any changes to the IP configuration, we must do it in the configuration of each one of the devices that we have configured in this way while if we do it from the router we will have all the configurations in one place.
To change this configuration we will connect by SSH to the Raspberry Pi and execute the following commands:
Get IP from the gateway and DNS server
If we know what the IP address of our gateway and DNS server is, we can go to the next step, otherwise, we will use the following commands:
To obtain the IP of the gateway we will use:
ip r | grep default
This will return something similar to this; the gateway IP address is the first IP listed
default via 192.168.20.1 dev eth0 proto dhcp src 192.168.20.11 metric 202
To obtain the IP of the DNS server we will use:
It will return something similar to this; the IP that interests us is the one that appears after nameserver
# Generated by resolvconf nameserver 192.168.20.1
Configure static IP
Now that we have the addresses of the gateway and the DNS server we will execute the following commands:
sudo nano /etc/dhcpcd.conf
Something similar to this will appear:
If we look at it, at the end of the file we have this commented text (with a # at the beginning of the line)
# Example static IP configuration: #interface eth0 #static ip_address=192.168.0.10/24 #static ip6_address=fd51:42f8:caae:d92e::ff/64 #static routers=192.168.0.1 #static domain_name_servers=192.168.0.1 18.104.22.168 fd51:42f8:caae:d92e::1
We will remove the comment symbols and complete it with the data corresponding to our installation, in my case it would be as follows (I have eliminated the line to assign an IPv6)
# Danatecc static IP configuration: interface eth0 # Replace with eth0 for Ethernet connection or wlan0 for Wifi connection static ip_address=192.168.20.11/24 static routers=192.168.20.1 static domain_name_servers=192.168.20.1 # To add more than one DNS server we will separate them with a space
We will close the file with CTRL+X and when it asks if we want to save the changes we will press Y
Finally we must restart the Raspberry Pi with the following command
Once the Raspberry Pi has been restarted we should be able to connect to it using the IP address that we have assigned to it.
If you have made it this far, thank you very much! If you have any questions, do not hesitate to leave them in the comments and I will do my best to help.
And don’t forget to subscribe to receive an email when new articles are published.