RaspberryPi 4
First, we need to burn the latest 64bit OS on the microSD card. At the time of writing, this was 2020-08-20-raspios-buster-arm64. The microSD card is not where we'll be writing the Cardano block data to, so 32GB is quite enough for the OS and Docker.
Once you've burned the OS on the card, you may want to enable SSH on boot before you power up your Pi for the first time. For this you need to put an empty file called SSH in the root directory of the microSD card.
1
$ touch /Volumes/boot/SSH
Copied!
When the Pi is running, you should be able to SSH into it, like this ...
2
password: raspberry
3
Linux raspberrypi 5.4.51-v8+ #1333 SMP PREEMPT Mon Aug 10 16:58:35 BST 2020 aarch64
4
...
5
Use raspi-config to set the country before use.
6
​
Copied!
You can now use raspi-config to change the default password, set the hostname, enable Wi-Fi, etc. One of the first things I usually do, is to add my public SSH key to ~/.ssh/authorized_keys
1
$ scp ~/.ssh/id_rsa.pub [email protected]:.ssh/authorized_keys
Copied!
For added security, we can then disable password authentication like this ...
1
$ sudo sed -i "s/^#PasswordAuthentication yes$/PasswordAuthentication no/" /etc/ssh/sshd_config
2
$ sudo cat /etc/ssh/sshd_config | grep PasswordAuthentication
3
PasswordAuthentication no
4
​
5
$ sudo systemctl restart sshd
Copied!
Make sure you can indeed login without password, before you disable that. For details on how to generate an SSH key, we kindly ask you to look here for example.
Now that our Pi is reasonable well secured, we can continue with the setup and update system packages.
1
$ sudo apt-get update
2
$ sudo apt-get full-upgrade -y
Copied!
System Time Synchronization
Keeping the system time synchronized among peers is quite important when we want to engage in peer-to-peer communication. Lets check real quick, whether the system time is getting synchronized ...
1
$ timedatectl
2
Local time: Mon 2021-01-18 22:02:59 GMT
3
Universal time: Mon 2021-01-18 22:02:59 UTC
4
RTC time: n/a
5
Time zone: Europe/London (GMT, +0000)
6
System clock synchronized: yes
7
NTP service: active
8
RTC in local TZ: no
Copied!
If that should not be the case, have a look at over here.
Enable memory accounting
Later, we'll be looking at how much memory the various docker containers consume while running. This is an important metric that we Stake Pool Operators (SPO) want to have an eye on. Lets check whether memory accounting is enabled at the kernel level.
1
$ cat /boot/cmdline.txt
2
console=serial0,115200 rootfstype=ext4 ... cgroup_memory=1 cgroup_enable=memory
Copied!
Add these last two cgroup settings in case they are not there already. Re-boot afterwards ...
1
$ sudo shutdown -r now
Copied!
Swap File Setup
The Pi comes with 8GB of RAM, which should be plenty to run a Cardano node. Still, lets setup a swap file in case the process has high memory spikes.
1
$ sudo dphys-swapfile swapoff
2
$ sudo sed -i "s/^CONF_SWAPSIZE=100$/CONF_SWAPSIZE=8192/" /etc/dphys-swapfile
3
$ sudo sed -i "s/^#CONF_MAXSWAP=2048$/CONF_MAXSWAP=8192/" /etc/dphys-swapfile
4
$ sudo cat /etc/dphys-swapfile | grep CONF
5
$ sudo dphys-swapfile setup
6
$ sudo dphys-swapfile swapon
7
$ free -h
8
total used free shared buff/cache available
9
Mem: 7.6Gi 104Mi 7.4Gi 8.0Mi 174Mi 7.4Gi
10
Swap: 8.0Gi 0B 8.0Gi
Copied!
Mount Data Disks
We won't be writing the block data to the microSD card. Instead, we'll be using an external SSD drive connected to one of the USB-C ports. Initially, this can be a SanDisk Ultra Fit USB 3.1 Flash Drive.
Fist, lets list the connected block devices
1
$ lsblk
2
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
3
sda 8:0 1 114.6G 0 disk
4
`-sda1 8:1 1 114.6G 0 part
5
mmcblk0 179:0 0 29.7G 0 disk
6
|-mmcblk0p1 179:1 0 256M 0 part /boot
7
`-mmcblk0p2 179:2 0 29.5G 0 part /
Copied!
Now, lets initialize the filesystem on that external drive. The commands below will re-partition the drive and format the file system. All existing data on that drive will be lost.
1
# DISK00 ########################################################################
2
​
3
DISK00=/dev/sda
4
MOUNT00=/mnt/disks/data00
5
​
6
# Create new empty filesystem:
7
$ sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,discard $DISK00
8
​
9
# Mount block storage
10
$ sudo mkdir -p $MOUNT00; sudo mount -o discard,defaults $DISK00 $MOUNT00
11
​
12
# Append to /etc/fstab
13
$ echo "" | sudo tee --append /etc/fstab
14
$ echo "$DISK00 $MOUNT00 ext4 defaults,noatime,nofail 0 0" | sudo tee --append /etc/fstab
Copied!
Make sure the mounted directory for the block data is empty and does not contain the lost+found folder. Otherwise the Cardano node will not accept this location.
1
$ sudo rm -rf /mnt/disks/data00/*
Copied!
This concludes the RaspberryPi setup. We can now continue with Installing Docker.
Last modified 10mo ago
Copy link