-
Very low memory consumption (~50MB utilised during idle vs ~350MB for Ubuntu 20.04).
-
Lower CPU overhead (27 tasks/ 31 threads active for Alpine vs 57 tasks / 111 threads for Ubuntu when cardano-node is running).
-
Cooler Pi 😎 (Literally, CPU runs cooler because of the lower CPU overhead).
-
And finally, why not? If you're gonna use static binaries, might as well take advantage of AlpineOS 😜.
If you have previously used this guide and intend to update the scripts. Follow these steps. Then follow the rest of the steps outlined in this guide accordingly 🙂.
- Update the git local repo.
cd ~/alpine-rpi-os
git fetch --recurse-submodules --tags --all
- Identify the latest tag.
git tag
- Replace <tag> in this step with the latest tag such as
v1.7.0
.
git checkout tags/<tag>
- Update your current version of AlpineOS.
sudo apk update
sudo apk upgrade
- Edit the repository to reflect Alpine v3.17.
sudo sed -i 's@v3.16@v3.17@g' /etc/apk/repositories
- Update the package list.
sudo apk update
- Upgrading packages to v3.17
sudo apk add --upgrade apk-tools
sudo apk upgrade --available
sudo sync
sudo reboot now
- Now you should have AlpineOS upgraded to v3.17 🍷.
cat /etc/alpine-release
- To troubleshoot the upgrade, refer to the link: https://wiki.alpinelinux.org/wiki/Upgrading_Alpine
-
Download the AlpineOS for RPi 4 aarch64 here.
-
Decompress the .tar.gz file and copy it's contents into an SSD/SD card.
-
Plug in a keyboard and monitor.
-
Login with username 'root'.
-
Run the command
setup-alpine
and follow the instructions. -
At the last step of
setup-alpine
, you will be prompted to choose the system disk. In case you have missed it, run the commandsetup-disk
and create the partition forsys
. You may have to retry and erase the entire disk. -
Reboot.
-
Add a new user called cardano via the command
adduser cardano
and its password as instructed. -
Run the following commands to grant the new user full root privileges.
apk add sudo
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
addgroup cardano wheel
addgroup cardano sys
addgroup cardano adm
addgroup cardano root
addgroup cardano bin
addgroup cardano daemon
addgroup cardano disk
addgroup cardano floppy
addgroup cardano dialout
addgroup cardano tape
addgroup cardano video
-
Either exit root via the command
exit
or reboot and login to cardano. You may continue the next steps via SSH for easy copy and paste 😁. -
Install bash to ensure bash script compatibility.
sudo apk add bash
-
Also install git, nano and wget, we will need it later.
sudo apk add git nano wget
-
[Optional] By default, AlpineOS uses the powersave governor which sets CPU frequency at the lowest. To use the ondemand governor which scales CPU frequency according to system load,
cpufreq.start
is included in this repo which should be added to /etc/local.d/. You may run the following commands to do this for you.cd ~
git clone https://github.com/armada-alliance/alpine-rpi-os
cd alpine-rpi-os
git tag
Replace <tag> with the latest tag in the next command such as
v1.7.0
.git checkout tags/<tag>
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/local.d/cpufreq.start /etc/local.d/
sudo chmod +x /etc/local.d/cpufreq.start
sudo rc-update add local default
-
[Optional] To alleviate RAM limitation on RPi, ZRAM is recommended to enable RAM compression. Use the following steps to install zram-init and install the scripts. The scripts provided will enable a 50% boost in useable RAM capacity. This step assumes you have followed step 13.
sudo apk add zram-init
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/local.d/zram.* /etc/local.d/
sudo chmod +x /etc/local.d/zram.*
-
Reboot the system.
Installing/Upgrading the 'cardano-node' and 'cardano-cli' static binaries (AlpineOS uses static binaries almost exclusively so avoid non-static builds)
You can obtain the static binaries for version 1.35.4 thanks to Moritz Angermann, the SPO of ZW3RK. You can follow the following commands to install the binaries into the correct folder:
-
Download the binaries.
wget -O ~/aarch64-unknown-linux-musl-cardano-node-1.35.4.zip https://github.com/armada-alliance/cardano-node-binaries/blob/main/static-binaries/1_35_4.zip?raw=true
-
Unzip and install the binaries via the commands.
unzip -d ~/ aarch64-unknown-linux-musl-cardano-node-1.35.4.zip sudo mv ~/cardano-node/* /usr/local/bin/ rm -r ~/cardano-node
If you have decided to use AlpineOS for your Cardano stake pool operations, you may find this collection of script and services useful.
-
Clone this repo to obtain the neccessary folder and scripts to quickly start your cardano node. You may skip this step if you have already clonned this repo from step 13 when setting up AlpineOS.
cd ~
git clone https://github.com/armada-alliance/alpine-rpi-os
git tag
Replace <tag> with the latest tag in the next command.
git checkout tags/<tag>
-
Run the following commands to then install the cnode folder, scripts and services into the correct folders. The cnode folder contains everything a cardano-node needs to start as a functional relay node.
cd ~
cp -r alpine-rpi-os/alpine_cnode_scripts_and_services/home/cardano/* ~/
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/init.d/* /etc/init.d/
chmod +x ~/start_stop_cnode_service.sh ~/cnode/autorestart_cnode.sh
sudo chmod +x /etc/init.d/cardano-node /etc/init.d/prometheus /etc/init.d/node-exporter
-
For faster syncing, consider this optional command for downloading the latest db folder hosted by one of our Alliance members.
wget -r -np -nH -R "index.html*" -e robots=off https://db.adamantium.online/db/ -P ~/cnode
-
Follow the guide written in README.txt contained in the $HOME directory after installing cnode, scripts and services.
more ~/README.txt
-
Download prometheus and node-exporter into the home directory.
wget -O ~/prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.36.2/prometheus-2.36.2.linux-arm64.tar.gz
wget -O ~/node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-arm64.tar.gz
-
Extract the tarballs.
tar -xzvf prometheus.tar.gz
tar -xzvf node_exporter.tar.gz
-
If you are upgrading from previous versions of prometheus and node-exporter, make a backup. You may delete these folders if they do not contain anything useful.
mv prometheus prometheus-bak
mv node_exporter node_exporter-bak
-
Rename the folders with the following commands.
mv prometheus-2.36.2.linux-arm64 prometheus
mv node_exporter-1.3.1.linux-arm64 node_exporter
-
Follow the guide written in README.txt contained in the $HOME directory after installing cnode, scripts and services to start the services accordingly.
more ~/README.txt
-
If you have trouble with port forwarding via SSH, run the following command
sudo nano /etc/ssh/sshd_config
Then edit the line
AllowTcpForwarding no
toAllowTcpForwarding yes
. Make sure this line is not commented with#
. -
If you run into a situation where you get the error:
/lib/rc/sh/openrc-run.sh: source: line 10: can't open '/home//cnode_env': No such file or directory
Do the following:
export USER=$(whoami) sudo ash -c "echo 'export USER=$USER' >> /etc/profile"
Then reboot:
sudo reboot