Welcome to the second part of our tutorial on how to set up a Raspberry Pi , so we can run a DecBC or ZooBC node in it.
In our first tutorial, we unboxed a Raspberry Pi to show you its components; we also demonstrated how to set the operating system up. If you haven’t checked the first part of this tutorial, I kindly suggest you do so to make it easier to understand the second part.
The first part of the tutorial has already been available on YouTube, called tutorial : Setting up a Raspberry Pi.
- First thing first, I want to connect to the monitor by plugging the USBC power source.
- Then plug the keyboard in with its built-in USB port. Afterward, connect the keyboard to the Raspberry Pi USB port.
- Next, connect the HDMI cable to the HDMI port in the Raspberry Pi. At the same time, we also have to connect the other part of the HDMI cable to the monitor.
- Last but not least, let’s turn on the Raspberry Pi by plugging it to the power cable. So now the Raspberry Pi computer is going to boot up and thus we have to wait for a little while until the monitor finally gets turned on.
Now that it has been turned on, I’m going to change the resolution of the screen so you can read everything shown in there.
- To change the resolution, first : we log into the Raspberry Pi. You can login using the username Pi and the password “raspberry”.
- Then it’s my turn to look at the Raspberry Pi interface as it appears on the monitor. From there, we need to run a configuration application to change the screen resolution. First, type the following command line:
$ sudo raspi-config
We enter a “sudo” code in order to gain administrative abilities at the main administrative access and the “raspi-config” to open the interface.
- As you can see from the image below, to change the screen resolution, we need to click the second option, namely the “Display Option”, before clicking the first submenu of the “resolution” menu.
- Afterward, I choose mode 3, which has a 720 by 480 resolution, which is a high one and thus make the contents easier to read. After we set the screen on high resolution, click the “finish” button, then click “reboot”.
Next, we need to make sure that the keyboard layout has been set correctly.
- Again, login using the username “pi” and password “raspberry”. Then, go back to the same application we had before with the following command line:
$ sudo raspi-config
- At this moment, we can go to option number five to check out some localization options.
- First, for the “locale” element, I can pick the configuration that works best for me.
- To explore more functions, scroll down using the “down arrow” on your keyboard. For the final setup, I pick English, the United States and the UTF-8, click “finish”, then reboot the system.
This is going to be re-set up again with the locals in a matching operating system. I choose this option, a preferred one among applications because it is the safest. Then, the option also works for my keyboard and artwork.
Now, let’s go back again to the configuration settings, and set up the WLAN country.
- First click the “Localized Option”, then click “L4”. Just as an example, I will choose Indonesia here.
Furthermore, let’s set up our keyboard mapping. Keyboard mapping is so crucial at this moment because if you do not set it up properly, you will end up getting frustrated through the process, because the consequence of poor keyboard mapping setup is: you will get a different result for the things which you type on the keyboard.
- So, in order to do the keyboard mapping, we can go back to the Localized Option, then choose “Keyboard”.
- At this point, I will choose the “105 key pc international” option. Beyond this, there are a lot of other mapping options which will be suitable to set up specific keyboards. As you already know, instances of popular keyboard brands include Logitech and Apple . In this case, you can pick an option which suits the keyboard brand you are using.
- To set up the application’s “country of origin”, I choose the English-US option. Then, you have to click the “standardization” option, for which I go to the normal “English-US” choice.
- Next, we will reboot the system with the “reboot” command. Then, we have to make sure that when we restart the system, we will be able to load the new setting that we have set up earlier .
Adding connection (Wifi):
- After you log back into the raspberry, we need to check our internet connection state by using the following command:
$ iwlist wlan0 scan | grep ESSID
- After we click “enter”, you can see that this command responds with the word “nothing”, which means we still need to set up our wi-fi connection.
Let’s go back to our configuration interface and click menu number one, which is a system option, then click the “wireless LAN” option.
- Then,enter the Wi-fi username and the password that is available to you. From now on, we already have another setup option by doing a Network at Boot.
- Click “yes” to all options, which means that when the Raspberry Pi is booting, and before we start with the node, we have already been connected to the internet.
- Once you’re done handling the internet connection, click “finish” and we can reboot the system, before we start running the node.
- To check whether we have successfully connected to the internet, is we have to insert this command:
$ w get http://www.google.com
- As you can see, using the above command, I am able to open Google on our browser. This means, we are already armed with the internet connection we need. With the essential internet connection in place, this system is now up and running, downloading all the packages which you need to monitor the updating process.
Another important setting of the Raspberry Pi is the interface option from the “configuration” menu.
- Click the “configuration”menu, then, you can go to the SSH and respond with a “yes” when you would like to enable the SSH server. If we don’t enable the SSH server, we won’t be able to connect remotely to the Raspberry Pi when we wish to run it without a keyboard and a monitor.
As you can see, now we have enabled the server. So, at this point, with all the prerequisites in place, we can try to connect to the Raspberry Pi.
Let’s connect the Raspberry Pi:
We can do so with the help of a virtual private server (VPS) which we rented online.
- First, let’s update the Raspberry Pi by using the following command:
$ sudo apt-get update
- Next, use the following command:
$ sudo apt-get upgrade
- Next, before we move on any further, let’s first of all check our IP address by using the following command:
The command will give you your address; don’t forget to save or write it somewhere so as not to lose it, because we will need to use it on our next steps.
- Afterward open and edit the dhcpcd.conf file with the following command:
$ sudo apt-get upgrade
- Keep scrolling down to the bottom of the file and write the new setting there.
static ip_adresss=192 168 100 129
statis routers=192 168 100 129
static domain_name_server= 192 168 100 129
- Next, save the new settings and reboot.
Afterward, you need to set two things up: 1) the ssh key that is allowed to connect, and: 2) change the settings that allow the root to connect without a password, but instead using the ssh keys.
- Next, let’s change the system into root by using the following command:
$ sudo su
This will automatically take us inside the pi, but before we begin, we need to go back to the home directory. In order to do that, use the following command:
$ cd ..
- Then, go inside the home directory:
$ cd /root/
- next, list all the files by using the following command:
$ ls -alsh
- Here, you can see that the .ssh directory has not been created yet, thus requiring us to create one by using the following command:
$ mkdir .ssh
- Then, go inside the .shh:
$ cd .ssh
- The next thing we need to do now is configure the file. We can perform the function using the same command line that we used in the vps:
$ pico /etc/ssh/sshd_config
- So, to search this file, we can just press “ctrl + w”. Change the “PermitRootLogin prohibit-password” into “PermitRootLogin without-password”.
- We need to set up other parameters to keep the internet connection stable. Just scroll down using the “down arrow” button and set it into; “TCPKeepAlive yes” ; “ClientAliveInterval 120”; “ClientAliveCountMax 999”
- The next step we need to take is to authorize our key. I already have my keys on the website, so I can just go to the directory:
- So now we have the authorized file; we just need to look inside to find it. We see that there are two “rsa” keys inside. At this point, it should be possible to connect to this Raspberry Pi from the local network which goes to the address.
Now that all the settings we need are already in place, let us put them to the test!! For the purpose of trying the system, I’m gonna move to a different computer .
Theoretically, if I can open it from there, I will then be able to shut it down and reboot it without needing to use any keyboards or monitors. So, brace yourself for the moment of truth….
My private key has already been set up inside the Raspberry Pi, so automatically, I should be able to connect to the server. Let’s see the root, which is now located in a local network: 192 168 100 129. Click enter then type “yes” and enter again to get into the root. And now, I already got to the root of the Raspberry Pi, which is pretty cool.
Afterward, let’s see if the configuration system works from here, by using the Raspi config command.
And yes I have the user interface here now but this is not something we are here to do. At this moment, we’d simply like to try to connect remotely to the Raspberry Pi, to see whether it can act as a server, exactly like those that we have set up. At this point, you are already set.
And now, I’m gonna show you how to shut the Raspberry Pi down and then you can run it independently if you want to. From here you can also access and go to the next tutorial on how to finally download and install the node in the Raspberry Pi.
To shut the server down, use the following command:
$ shutdown -h now
The Raspberry Pi has now been turned off, thus concluding the last part of the raspberry pi setup. To get a more detailed look into the setup written in this tutorial, you can watch our video: Setting Up Raspberry Pi for DecBC part 2.