Searchโ€ฆ
Alpine Linux OS ๐Ÿ—ป

Why use AlpineOS on the Raspberry Pi? Here are some reasons:

    Very low memory consumption (~50MB utilized 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 ๐Ÿ™‚.

1) Update the git local repo.
1
cd ~/alpine-rpi-os
Copied!
1
git fetch --recurse-submodules --tags --all
Copied!
2) Identify the latest tag.
1
git tag
Copied!
3) Replace <tag> in this step with the latest tag such as v1.2.1.
1
git checkout tags/<tag>
Copied!

Upgrading to Alpine v3.14 from Alpine v3.13:

1) Update your current version of AlpineOS.
1
sudo apk update
Copied!
1
sudo apk upgrade
Copied!
2) Edit the repository to reflect Alpine v3.14.
1
sudo sed -i '[email protected]@[email protected]' /etc/apk/repositories
Copied!
3) Update the package list.
1
sudo apk update
Copied!
4) Upgrading packages to v3.14
1
sudo apk add --upgrade apk-tools
Copied!
1
sudo apk upgrade --available
Copied!
1
sudo sync
Copied!
1
sudo reboot now
Copied!
5) Now you should have AlpineOS upgraded to v3.14 ๐Ÿท.
1
cat /etc/alpine-release
Copied!
6) To troubleshoot the upgrade, refer to the link: https://wiki.alpinelinux.org/wiki/Upgrading_Alpineโ€‹

Initial Setup for AlpineOS on Raspberry Pi 4B 8GB:

2) Decompress the .tar.gz file and copy it's contents into an SSD/SD card
3) Plug in a keyboard and monitor.
4) Login with username 'root'.
5) Run the command setup-alpine and follow the instructions.
When you are in setup-alpine you will be prompted to choose the system disk. Once you are at this point, enter, y, to setup disk and create the partition for sys.
6) Reboot.
7) Add a new user called cardano via the command adduser cardano and its password as instructed.
8) Run the following commands to grant the new user root privileges
1
apk add sudo
2
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
3
addgroup cardano wheel
4
addgroup cardano sys
5
addgroup cardano adm
6
addgroup cardano root
7
addgroup cardano bin
8
addgroup cardano daemon
9
addgroup cardano disk
10
addgroup cardano floppy
11
addgroup cardano dialout
12
addgroup cardano tape
13
addgroup cardano video
Copied!
9) Either exit root via the command exit or reboot and login to cardano
10) Install bash to ensure bash script compatibility
1
sudo apk add bash
Copied!
11) Also install git and wget, we will need it later.
1
sudo apk add git wget
Copied!
12) 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.
1
cd ~
Copied!
1
git clone https://github.com/armada-alliance/alpine-rpi-os
Copied!
1
git tag
Copied!
Replace <tag> with the latest tag in the next command.
1
git checkout tags/<tag>
Copied!
1
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/local.d/cpufreq.start /etc/local.d/
Copied!
1
sudo chmod +x /etc/local.d/cpufreq.start
Copied!
1
sudo rc-update add local default
Copied!
12) [CPU Governor - 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.
1
cd ~
Copied!
1
git clone https://github.com/armada-alliance/alpine-rpi-os
Copied!
1
cd alpine-rpi-os
Copied!
1
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/local.d/cpufreq.start /etc/local.d/
Copied!
1
sudo chmod +x /etc/local.d/cpufreq.start
Copied!
1
sudo rc-update add local default
Copied!
13) [ZRAM - 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 12.
1
sudo apk add zram-init
Copied!
1
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/local.d/zram.* /etc/local.d/
Copied!
1
sudo chmod +x /etc/local.d/zram.*
Copied!
14) Reboot the system. For the Raspberry Pi 4B 8GB, you should expect around 3.81GB of swap via ZRAM when checking with htop (sudo apk add htop if htop is unavailable).

Installing/Upgrading the 'cardano-node' and 'cardano-cli' static binaries (AlpineOS uses static binaries almost exclusively so avoid non-static builds)

You may obtain the static binaries for version 1.30.1 via this link courtesy of Moritz Angermann, the SPO of ZW3RK pool ๐Ÿ™
Run the following commands to download and install the binaries into the correct directory.
    Download the binaries
1
wget -O ~/aarch64-unknown-linux-musl-cardano-node-1.30.1.zip https://ci.zw3rk.com/build/409517/download/1/aarch64-unknown-linux-musl-cardano-node-1.30.1.zip
Copied!
    Unzip and install the binaries via the commands
1
unzip -d ~/ aarch64-unknown-linux-musl-cardano-node-1.30.1.zip
2
โ€‹
3
sudo mv ~/cardano-node/* /usr/local/bin/
Copied!

Install the Armada Alliance Alpine Linux Cardano node service

If you have decided to use AlpineOS for your Cardano stake pool operations, you may find this collection of scripts and services useful.

To install the scripts and services correctly don't skip steps ๐Ÿดโ€โ˜ ๏ธ๐Ÿ˜Ž

1) 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 12 when setting up AlpineOS.
1
cd ~
Copied!
1
git clone https://github.com/armada-alliance/alpine-rpi-os
Copied!
1
git tag
Copied!
Replace <tag> with the latest tag in the next command.
1
git checkout tags/<tag>
Copied!
2) 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.
1
cd ~
Copied!
1
cp -r alpine-rpi-os/alpine_cnode_scripts_and_services/home/cardano/* ~/
Copied!
1
sudo cp alpine-rpi-os/alpine_cnode_scripts_and_services/etc/init.d/* /etc/init.d/
Copied!
1
chmod +x ~/start_stop_cnode_service.sh ~/cnode/autorestart_cnode.sh
Copied!
1
sudo chmod +x /etc/init.d/cardano-node /etc/init.d/prometheus /etc/init.d/node-exporter
Copied!
3) For faster syncing, consider this optional command for downloading the latest db folder hosted by one of our Alliance members.
1
wget -r -np -nH -R "index.html*" -e robots=off https://db.adamantium.online/db/ -P ~/cnode
Copied!
4) Follow the guide written in README.txt contained in the $HOME directory after installing cnode, scripts, and services.
1
more ~/README.txt
Copied!

Setup prometheus and node exporter

1) Download Prometheus and node-exporter into the home directory
1
wget -O ~/prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-arm64.tar.gz
Copied!
1
wget -O ~/node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-arm64.tar.gz
Copied!
2) Extract the tarballs
1
tar -xzvf prometheus.tar.gz
Copied!
1
tar -xzvf node_exporter.tar.gz
Copied!
3) Rename the folders with the following commands
1
mv prometheus-2.29.2.linux-arm64 prometheus
Copied!
1
mv node_exporter-1.2.2.linux-arm64 node_exporter
Copied!
4) Follow the guide written in README.txt contained in the $HOME directory after installing cnode, scripts and services to start the services accordingly.
1
more ~/README.txt
Copied!

General Troubleshooting

    If you have trouble with port forwarding via SSH, run the following command
1
sudo nano /etc/ssh/sshd_config
Copied!
    Edit the line AllowTcpForwarding no to AllowTcpForwarding yes
Make sure this line is not commented out with a#
We would like to give a special shoutout to our alliance member, Sayshar, operator of [SRN] Pool, for providing this tutorial ๐Ÿดโ€โ˜ ๏ธ ๐Ÿ™ ๐Ÿ˜Ž
Last modified 18d ago