
Intermediate · 1 hour
Development on Algorand using Raspberry Pi - Part 1
This is the first in a multi-part tutorial series focusing on the Raspberry Pi, an inexpensive desktop computer. In this tutorial, we start from scratch with a brand new Raspberry Pi (RPi) and configure remote access using SSH. Those experienced with RPi basics may skip ahead to the next tutorial where we will install the Algorand software, configure algod
as a participation node and install our first software development kit (SDK).
As a new developer, we provide steps on how to get started with your initial Raspberry Pi setup. This device will be used as your Algorand development environment in future turoirals.
You will learn:
- How to select your Raspberry Pi
- How to use Raspberry Pi Imager to install the OS
- How to configure remote connection over remote desktop
- How to configure remote connection over Secure Shell (SSH)
Slides available here. The video guide is embedded below.
Requirements
- Raspberry Pi (needs at least 4GB of RAM and 100GB storage to be a viable node, requirements)
- SD card reader
- Raspberry Pi Imager
Info
If you are using Windows 10, it is recommended to use WSL 2 (see this tutorial).
Background
Raspberry Pi(RPi) is a small single-board computer that runs an ARM processor. It is offered in various forms and hardware specifications. For this tutorial series is recommended to have RPi 4 model B with 4GB RAM and an SD card with a capacity of 64GB or more.
You will also need external peripherals such as a mouse, keyboard, and monitor during the initial configuration, but just temporarily before we configure remote access.
Our setup topology will look as follows:
Where host machine will be used for remote work on the RPi. Important, both the RPi and the host machine have to be in the same network (e.g. on same WiFi).
In the Steps, we discuss the main steps required to run a RPi. For more details, I recommend following the provided video with a detailed explanation. As the tutorial is done using the WSL with Ubuntu 20.04 distribution, the syntax follows these steps on host machine side.
Steps
-
1. Install Pi Imager
-
2. Format SD Card
-
3. Choice of OS
-
4. Run the RPi
-
5. Install requirements on the RPi
-
6. Setup SSH connection the RPi
-
7. Setup SSH connection on the host machine
-
8. Finish SSH configuration on the RPi
-
9. Establish first connection
-
10. (Optional) Remote Desktop - where is the IP
-
11. (Optional) Use Windows Remote Desktop Connection
-
Next steps
1. Install Pi Imager
Navigate to RPi homepage and download RPi Imager for your OS from https://www.raspberrypi.org/software/
2. Format SD Card
After starting Pi Imager and inserting the SD card to your PC, format it from exFAT to FAT32.
3. Choice of OS
Choose the recommended RPi official image in the recommended configuration - no need for all packages.
4. Run the RPi
After the OS is successfully installed on the SD card, we can plug it in to the RPi and connect required peripherals - a mouse, keyboard, and monitor. With the RPi running, we can start with the initial configuration.
5. Install requirements on the RPi
After you connect to your RPi install the following tools:
- Always run update before
sudo apt-get update
- Editor of preference, in our case vim
sudo apt-get install vim
- Install package for remote desktop
sudo apt-get install xrdp
6. Setup SSH connection the RPi
First, we setup the SSH connection, for that we execute following steps:
- Open ssh configuration file as
sudo vi /etc/ssh/sshd_config
Port 22
uncommentPubkeyAuthentication yes
uncomment- For the changes to take be applied run
sudo service ssh restart
- To make the ssh deamon start after reboot of the Raspberry Pi run
systemctl enable ssh
7. Setup SSH connection on the host machine
Now, on your host machine, we generate a key-pair generate a key-pair and store the public key on Raspberry for remote access
- First, we generate a key-pair
ssh-keygen
- We register the public key on the RPi
ssh-copy-id <key_name>.pub [email protected]
- You can
ssh [email protected]
8. Finish SSH configuration on the RPi
Now, once the public key is registered, we can enforce only this for of authentication. Change the configuration of ssh /etc/ssh/sshd_config
to deny password connection to no - PasswordAuthentication no
9. Establish first connection
You can now connect from the host to the host machine over ssh using following command ssh [email protected]
. In case it does not work, make sure your computer and the RPi are on the same network.
10. (Optional) Remote Desktop - where is the IP
In case you prefer to use the remote desktop, we need to identify the IP address on the RPi. On the RPi execute ip addr
in the terminal. Depending on if you are using Wi-Fi or Ethernet connection, choose a corresponding IP. In my case it is the IP 192.168.0.5.
11. (Optional) Use Windows Remote Desktop Connection
Open Windows Remote Desktop Connection and insert the IP address.
Click Connect, and Yes once prompted. Next insert the RPi credentials:
- username: pi
- password: {your_choice}
You should be at the desktop of the RPi.
Next steps
You have successfully installed an operating systems and configured your RPi for remote access based on our preferences. Continue on to the next tutorial for instructions on installing the Algorand software in preparation for connecting to the network and solution development.