Install and Configure Raspbian on Raspberry Pi

Introduction: Install and Configure Raspbian on Raspberry Pi

About: The MasterWalker Shop is a virtual store selling products for robotics, automation and electronic components. We are active in the market since 2011, always with the objective of guaranteeing our customers q...

This tutorial is for people who want to install Raspbian on Raspberry Pi.

Initially, this tutorial was written in Portuguese here in Brazil. I tried my best to write it in English. So forgive me for some mistakes that might be in writing.

This instruction was divided as follows:

Step 1: A little about and the Raspberry Pi

Step 2: Prepare and install Raspbian

Step 3: Enable SSH and VNC

Step 4: Set static IP for access

Step 5: Access the board remotely via terminal (SSH)

Step 6: Access the board remotely via graphical interface (VNC)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: A Little About and the Raspberry Pi

Raspberry Pi is the name of a line of microcomputers manufactured by the Raspberry Pi Foundation and headquartered in the United Kingdom. The foundation's vision is to make it easier for people to access computing.

People around the world use Raspberry Pi to train programming, develop hardware and software projects, implement home automation projects, apply to industrial projects, implement IoT (Internet of Things) projects, and to play video games through retrogame systems, for example Recalbox and Retropie.

Raspberry may run some variants of known operating systems, but the most used is Raspbian.

Raspbian is a free Debian-based Linux variant, the result of a constantly developing community project focused on stability and performance of as many Debian packages as possible. This operating system is optimized to run on Raspberry Pi and can be downloaded directly from the Raspberry Foundation website.

Step 2: Prepare and Install Raspbian

Running Raspbian on Raspberry Pi requires installing the system on a micro SD memory card of at least 8GB and preferably class 10.

You can install Raspbian on all versions of Raspberry Pi. For this tutorial I am using Raspberry Pi 3 Model B +.

To proceed with the installation and configuration of the operating system you will need the following items:

01 - Raspberry Pi
01 - Power Supply for Raspberry Pi 3 (Pi 2 / B / B+)
01 - Acrylic Case with Cooler for Raspberry Pi 3 (optional)
01 - Micro SD Memory Card (16Gb ou 32Gb)
01 - Memory Card SD Reader
01 - HDMI Monitor
01 - HDMI Cable
01 - Mouse
USB
01 - Keyboard USB

You can use a TV as a monitor as long as it has an HDMI connection. The monitor will only need once so we can make the settings on the board. Later access to the system will be done remotely through another computer. The use of the case with cooler is optional, but it is ideal, because this way your board is protected and keeps cool during the period when it is being used.

Use a micro SD card reader to connect the memory card to the computer:

Download SD Memory Card Formatter and install:

https://www.sdcard.org/downloads/formatter/eula_windows/index.html

After installation, open the program, select the drive in which your memory card was allocated, check the "Quick format" option, click "Format" and wait for the procedure to finish:

Download Raspbian with desktop and recommended software:

https://www.raspberrypi.org/downloads/raspbian/

After downloading, unzip the file so that the image is generated.

Download Etcher and install:

https://www.balena.io/etcher/

Open Etcher, select the Raspbian image you downloaded, select the memory card drive where the image will be recorded, click "Continue", click the "Flash" option, wait for the procedure to finish, and close the program:

Remove the card reader from the computer, remove the card from the reader, and insert into Raspberry Pi. Plug the HDMI cable into the Raspberry Pi and the monitor, plug in the power supply to power it.

With the monitor turned on, wait for the system to boot. After booting you will come across a screen similar to the image below:

You will be prompted to select country settings, language settings, and WiFi network connections. After connecting to WiFi, open the browser on the left in the top bar and try to access any website to confirm that you have internet access.

It may be that the system makes some updates on this first boot and reboots, so just wait to proceed.

Step 3: Enable SSH and VNC

After enabling these two options the board can be accessed remotely via SSH terminal or VNC graphical interface. At the top left click on the raspberry, "Preferences" and "Raspberry Pi Configuration":

Click on "Interfaces," check "Enable" for SSH and VNC, and click OK:

With these options enabled Raspberry Pi is now ready to allow remote access via SSH or VNC.

Step 4: Set Static IP for Access

By default the board will be connecting to the network (ethernet or WiFi), get a dynamic IP and on each connection you can get a different IP address from the previous connection, so whenever you do remote access the board will need to check if the IP remains the same. For this reason, we will set a fixed IP address.

Open the terminal:

From here you will handle command lines so you can configure or perform actions on the platform. I recommend that you continue to follow this tutorial directly from Raspbian, as this way you can copy and paste the commands that will be used next. To do this, simply open the Raspbian web browser, access this instructables and then continue from here.

The command lines below you will type in the terminal and press enter to execute. In some commands you may be asked for confirmation and you should read and confirm.

ip r | grep default

Note that a line is returned showing two IP addresses, the first being the gateway for access to your router and the second address is the one assigned to your Raspberry Pi. Note that in my case the first address is ending in "2.1" and the second address is ending in "2.112". The last three digits of the second address change on each device connected to your router. Chances are the addresses presented to you will differ from those shown in the image. Write down the first address (gateway) as you will need it later.

Type the command below at the terminal and hit enter:

sudo nano /etc/resolv.conf

In the terminal opens the file containing the DNS information of your network. Write down the address shown on the first line (primary DNS) and then note the second (secondary DNS). Press the CTRL + X keys on the terminal to close the file.

Type the command below at the terminal and hit enter:

sudo nano /etc/dhcpcd.conf

Use the down key on the keyboard or scrolling to the end of the file so you can make the appropriate edits:

1) If you are using a network cable connected to your Raspberry to assign network connection, you do not need to change the interface, but if you are using WiFi connection, delete eth0 and write wlan0.

2) In "static ip_address =" delete the information and write the IP address that will be assigned to your Raspberry, remembering to keep the default gateway, but changing the last three digits of the address. You can choose any number (from three digits) up to 254. Prefer to use higher numbers to avoid potential IP conflicts on your network. Keep / 24 after the IP address you choose.

3) In "static routers =" delete the information and write the gateway address of your router that you noted earlier.

4) Delete the information and write the primary DNS you noted earlier.

5) Delete the information and write the secondary DNS you noted earlier.

6) Erase the “#” signs from the lines you edited. Note that the lines where the pound sign “#” is erased will be a different color.

After the changes you will have a file with information similar to the image below, but with your network data:

To save the file edits press CTRL + O and then CTRL + X to close the file.

Then type the command below into the terminal and press enter to restart the system and apply the settings:

sudo reboot

After rebooting the system, open the terminal again, type the command below and press enter to verify that the previous settings are OK:

ip r | grep default

Open the left browser in the top bar and try to access any site to confirm that you have internet access.

This IP address you set for Raspberry Pi is fixed and will not change on new connections. Save it for use when accessing the board remotely.

NOTE: If you change the router and the gateway IP range changes, change the DNS addresses or change the connection interface, be sure to make changes to the files so that the board does not lose connection to the network.

Step 5: Access the Board Remotely Via Terminal (SSH)

To access Raspberry Pi remotely via terminal and without graphical interface you can use SSH (Secure Shell). You can use, for example, Putty or any other tool for such a purpose that you like. I particularly use the Windows command prompt itself, in this case Windows PowerShell.

Assuming SSH is already enabled on Raspberry Pi, go to the Windows "Start" menu, search for Windows PowerShell and when you find it, right click on it and select "Run as administrator":

With the command prompt open, you must enter the command ssh pi@ with your Raspberry's IP address after @. Assuming you set IP 192.168.0.120 for your Raspberry, the command would then be:

ssh pi@192.168.0.120

In my case, Raspberry Pi has a fixed IP 192.168.2.129, so I will type the line below and press enter:

ssh pi@192.168.2.129

At first access via ssh you will be prompted for confirmation, you must type yes and press enter. Finally, you will be prompted for the password that you must enter and press enter. If you have not changed your password it will be raspberry:

To test remote access via terminal, type the command below and enter in Windows PowerShell:

ip r | grep default

If everything is OK, the return will be information we have already seen, which shows the gateway IP address of the router Raspberry is connected to and the IP address that was assigned to the board. If you copy a command line from somewhere and want to paste it into the terminal, just at the prompt right click the copied line will be pasted and pressing enter the command (if valid) will be executed. To clear terminal commands, simply type reset and press enter. All the commands you enter have been saved in memory and to access these commands simply press the up key on your keyboard.

With remote access working, you can control your Raspberry Pi from other computers or devices that allow you to use a terminal and are connected to the same network as the board.

Step 6: Access the Board Remotely Via Graphical Interface (VNC)

If you want or need to access your Raspberry Pi remotely, but through a graphical interface, you will need to use VNC (Virtual Network Computing). Assuming VNC is already enabled on Raspberry Pi, download VNC Viewer and install:

https://www.realvnc.com/pt/connect/download/viewer/windows/

After the download open the program and in the field enter the IP address of your Raspberry Pi.

Assuming you set IP 192.168.0.120 for your Raspberry Pi, write the IP and the program will ask you if you want to make a connection or you can press enter. In my case, Raspberry has the fixed IP 192.168.2.129. You will be prompted for the username (pi) and password. If you have not changed your password it will be raspberry:

A new window will open where you can see the mirroring of your Raspberry Pi's GUI and hovering at the top will give you access to the VNC Viewer options menu:

A new window will open where you can see the mirroring of your Raspberry Pi's GUI and hovering at the top will give you access to the VNC Viewer options menu:

With remote access working, you can control your Raspberry Pi from other computers or devices that have VNC Viewer installed and are connected to the same network as the board.

After Raspbian is installed and configured, you can explore system functionality and learn a little more about using command lines on Linux-based systems.

If you have IoT and home automation devices, but can't integrate them with Homekit's Home app and Siri because they're not Apple certified, I recommend reading the instructables Install Homebridge on Raspberry Pi and Windows.

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions