Safe Network Node on 64-bit ARM servers Installation Guide [Manjaro minimal] - Second edition

Introduction

This guide will tell you howl to install a safe network node on any server computer that runs on an ARM chip. Once running, you will earn safe network tokens. Good luck!

Note: As of now, only the first half of this guide functions as intended, that is step 1 to 5, or the proper installment of the SD card. I’m still working on step 6, the proper installment of the safe application.

Note: The safe network is still in it’s testing phase, so all earned safe network tokens will be destroyed at the end of each test run.

Note: For those of you who are absolute beginners when it comes to server computers.
A server computer is not necessarily any different from a client computer. Any computer can be a server computer. What’s often different about ‘server computers’ is that they often lacks support for monitors, speakers and other components aimed at human sensors. Server computers sit in a corner and uploads data to whomever requests it.

Note: Manjaro ARM no longer supports armv7h architecture. So if you have a armv7h device, you will have to find another guide or buy a newer ARM server.

Requirements

Client computer

  • A Desktop or laptop

Server computer

Minimal

  • 64-bit ARM computer (Raspberry Pi 4 in picture)
    • Motherboard
    • Case
    • Power Adapter
  • SD Card - (Endurable recommended)
  • SD Card reader
  • Ethernet cable

Highly recommended

  • A display-providing cable for your ARM server in case it loses connection:
    • Monitor with HDMI cable : USB-C in to HDMI out cable
    • Monitor with displayport cable : USB-C in to Disyplayport out cable (not in picture)
    • No monitor : Raspberry Pi Display (not in picture)
  • For those who use of the Raspberry Pi 4 as their server, the Raspberry Pi 4 Heatsink

Recommended (not in picture)

  • External storage

Steps

WARNING! For Manjaro OS users that know one can skip step 1 to 3 simply by running manjaro-arm-installer straight away, it is highly recommended to follow these steps carefully as a virtual machine protects you from calamity. This tutorial writer did not follow his own advice and had accidentally deleted his entire computer. Please do not be as stupid as him.

Step 1: Download and install Libvrt (or Virtualbox), Vagrant and Manjaro OS

Windows 10/11

Recommendation: Chocolately

Chocolately is a package manager, which is like an app store full of free adless software. Go to https://chocolatey.org/ and follow the instructions. Once you have downloaded and installed chocolately, downloaded, installed and started choco-gui, you can install both Vagrant and virtualbox via Chocolately-gui, as vagrant-libvirt has so far has not been able to work with Windows.

– Todo

For Mac OS users

– Todo

For Arch Linux OS users

Open your terminal and type

sudo pacman -S vagrant virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

For Debian Linux OS users

sudo apt install vagrant virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

For Fedora Linux OS users

sudo yum install vagrant virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

Step 2: Run vagrant, download, install and run the MAI-box

Create a folder in your home directory named vagrant.
Open your terminal and navigate towards this folder.
Then type the following:

vagrant plugin install libvrt
vagrant init safenetwork-community/manjaro-arm-installer
vagrant up

Step 3: Insert SD card and run the MAI-box

Once done, start virt-machine, insert your SD card and choose
View->Add Hardware->USB host device and then choose your SD card.

Go back to the terminal and type the following:

vagrant ssh

Step 4: Install Manjaro Minimal onto your SD card

Note: There’s no need for difficult passwords right away, because we’re going to use SSH keys and then via SSH we can change those passwords.

WARNING! If you are not careful with one of the steps during the procedure and choose vda, you will overwrite your virtual machine and have to do Step 1 over again.

asciicast

As in the video choose the following:

YOUR_ARM_COMPUTER_MODEL 
minimal
YOUR_USERNAME 
wheel,sys,audio,input,video,storage,lp,network,users,power
YOUR_FULLNAME 
A_SIMPLE_PASSWORD 
REPEAT
A_SIMPLE_PASSWORD 
REPEAT
sda <- [READ WARNING ABOVE!]
btrfs
YOUR_TIMEZONE
YOUR_LOCALE (default: en_US)
YOUR_TTY_KEYBOARD_LAYOUT (default: us) 
YOUR_HOSTNAME (default: Safenetwork-one)

Once the installment is finished, enter these commands (ROOT_MNJRO=ROOT_MNJRO):

curl https://link.tardigradeshare.io/s/julx763rsy2egbnj2nixoahpobgq/rezosur/safe_network_dev_environment_setup.sh?download -o safe_network_dev_environment_setup.sh
curl https://link.tardigradeshare.io/s/julx763rsy2egbnj2nixoahpobgq/rezosur/sshd_config?download -o sshd_config
mkdir /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/{safe,safenetwork-node,.ssh} 
mv safe_network_dev_environment_setup.sh /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/safe/
sudo mv -b sshd_config  /run/media/$USER/ROOT_MNJRO/@/ssh
ssh-keygen -t ed25519 -N <passphrase> -C "USER@HOSTNAME"
cat ~/.ssh/id_ed25519.pub | tee -a /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/.ssh/authorized_keys

Step 5: Access your ARM server computer via SSH

Pull your Mirco SD card out of your reader and push it into your ARM server.
Connect the ethernet cable to your modem and turn your ARM server on.

On your client computer terminal type the following command to connect to your server:

ssh YOUR_USERNAME@YOUR_HOSTNAME

This should give you access to your server computer.

Next use a password manager (example: KeepassXC) for generating and managing passwords.
Then type these commands:

passwd
YOUR_PASSWORD
NEWLY_GENERATED_PASSWORD
REPEAT
sudo su
passwd
NEWLY_GENERATED_PASSWORD
REPEAT
exit

Run the safe network script which should download and setup podman on your server computer.
This requires a reconnect in order for Manjaro to provide new user permissions.

sudo sh ~/safe/safe_network_dev_environment_setup.sh
exit
ssh YOUR_USERNAME@YOUR_HOSTNAME

Step 6: Start the node

Note: As of now, only the root nodes work and only locally. I’m working on finishing the rest as soon as possible.

Pull the safenetwork-node image from podman.
It should immediately run the node once the build has been completed.

For all types of nodes

Because the safe network uses a genesis key, it’s required if you use multiple nodes to have a shared network folder, but even if you don’t, having a shared folder with the host is useful in case your container crashes, the data won’t be lost with it.

To share your local cli folder type the following

mkdir -p ~/.local/share/safe/cli/
podman unshare chown 1000:1000 -R ~/.local/share/safe/cli

For those who want to join an existing ipv4-only safe network

First pull the image.

podman pull ghcr.io/safenetwork-community/joinnode-ipv4:main

Then continue by running the node.

podman run \
--name safe_node_1 \
--restart always \
--publish 127.0.0.1:12000:12000/tcp \
--publish 127.0.0.1:12000:12000/udp \
--env NETWORK_NAME="local-ipv4" \
--mount type=bind,source=~/.local/share/safe/cli/,destination=/home/admin/.safe/cli/ \
-d ghcr.io/safenetwork-community/joinnode-ipv4:main

For those who want to join an existing ipv6-only safe network

First pull the image.

podman pull ghcr.io/safenetwork-community/joinnode-ipv6:main

Then continue by running the node.

podman run \
--name safe_node_1 \
--restart unless-stopped \
--publish [::1]:12000:12000/tcp \
--publish [::1]:12000:12000/udp \
--env NETWORK_NAME="local-ipv6" \
--mount type=bind,source=~/.local/share/safe/cli/,destination=/home/admin/.safe/cli/ \
-d ghcr.io/safenetwork-community/joinnode-ipv6:main

For those who want to start an ipv4-only safe network

First pull the image.

podman pull ghcr.io/safenetwork-community/rootnode-ipv4:main

Then continue by running the node.

podman run \
--name root_node \
--restart unless-stopped \
--publish 127.0.0.1:12000:12000/tcp \
--publish 127.0.0.1:12000:12000/udp \
--mount type=bind,source=~/.local/share/safe/cli/,destination=/home/admin/.safe/cli/ \
-d ghcr.io/safenetwork-community/rootnode-ipv4:main

For those who want to start an ipv6-only safe network

First pull the image.

podman pull ghcr.io/safenetwork-community/rootnode-ipv6:main

Then continue by running the node.

podman run \
--name root_node \
--restart unless-stopped \
--publish [::1]:12000:12000/tcp \
--publish [::1]:12000:12000/udp \
--mount type=bind,source=~/.local/share/safe/cli/,destination=/home/admin/.safe/cli/ \
-d ghcr.io/safenetwork-community/rootnode-ipv6:main

For those who want to run multiple nodes on the same machine

Just increase the last port number.
So while your first node runs -p 12000:12000,
your second node should be running with -p 12001:12000.

Conclusion

Congratulations and welcome to the club!
You can also run the safe command line interface from the server side and take a look inside at your hard earned money from running your server farm.

podman exec -it safe_node_1 safe

Happy safe networking!


Extra

Install Lunarvim

Lunarvim is a text-based editor with a steep learning curve, but great for programmers.

bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
sudo ln -s ~/.local/bin/lvim /bin/lvim
echo -e "export EDITOR=/bin/lvim\nalias vi=lvim\nalias vim=lvim\nalias nvim=lvim" | tee -a ~/.bashrc

Fira ligatures

As a favorite font for editing in servers, choose fira-code.

sudo pacman -S yay
yay -S nerd-fonts-fira-code

Add termbin

Useful for any error you encounter in the Manjaro Minimal OS.

Note: This has already been added in safe every podman image.

echo -e "tb=\"nc termbin.com 9999\"" | tee -a ~/.bashrc

Example:

podman images && podman ps -a | tb

Troubleshooting

In case your node unexpectedly quits first check the logs:

podman logs safe_node_1

If needed, you can also enter the container like this:

podman commit safe_node debug/safe_node_1
podman run -it --rm --entrypoint=/bin/bash --name debug_node_1 debug/safe_node_1

And then run a pastebin debug command like this:

nodebin

Project plan

Safe network in a container project v1.0

Tailored manjaro OS installment to safe network project v1.0

Choices made

Linux over Windows/Apple

  1. Open source.
  2. The freedom that comes with it.

Manjaro OS over any other Linux OS

  1. It’s package manager.
    1.1 Being able to easily search which file belongs to which package can sometimes be extremely helpful.
    1.2 I already use Manjaro OS as my client computer and that’s due to pamac, the GUI package manager Arch Linux does not ship by default.
  2. Semi-rolling release for young applications.
    2.1 Lunarvim for example is very new and constantly needs the latest packages.

Manjaro OS over Parabola GNU/Linux-libre

  1. There is no parabola-arm-installer.
  2. Parabola GNU/Linux-libre shuts down everything that’s not open source. I’ve had bad experiences with that, so I’m hesitant to try again.

Vagrant & manjaro-arm-installer over BalenaEtcher.

  1. Why waste a perfectly good installer tailored for Manjaro OS and ARM64 machines?
  2. The one downside with a naked manjaro-arm-installer is with the devices option. I had already killed my harddisk once with this app, thus I already had the motive to create a safe wrapper around it.

Podman over Docker.

  1. Podman has built-in IPv6 support.
12 Likes

I couldn’t this post on the other thread anymore, so here it is again.

3 Likes