Raspberry Pi3 model B is a microcomputer for doing almost anything. Let's use it for installing storagenode for V3 of the Storj Network!
In this guide we assume that you have a Raspberry Pi 3, set up with Raspbian Stretch lite (without User Interface). To set up Raspbian lite, please refer to the official documentation here.
Set up your Pi to allow SSH (it will make your life a lot easier): https://www.raspberrypi.org/documentation/remote-access/ssh/
Note. If you want to enable SSH on headless Pi, you should place an empty
ssh file in the boot partition on your SD-card. This will enable the ssh daemon on your Pi after boot.
Connect to the RPi via ssh and follow the steps below.
If your card is big enough, you can extend the system to use the whole available space (by default you have only a few MB in the root partition).
Run the raspi-config to extend it:
Navigate to the Advanced Options, then choose Expand Filesystem. After a while you should see a screen like this:
When you exit from the raspi-config, it will suggest you to reboot. Please, do it.
It is recommended to replace the default password for the default user pi for security reasons. Please, do so.
Please, configure the passwordless login via ssh (see details in the section Using key-based authentication) and after that, make sure that you can login with your public key, after which you can disable the password authentication completely.
To continue with this guide, please use the
screen command, this will enable you to still reconnect to a disconnected session using the
screen -x command after logging in via ssh.
sudo apt-get install screen screen
Formatting and mounting your HDD
Please, do not format your HDD again, if it already contains the storagenode's data and you want only to mount it after an OS reinstall!
Format your hard drive
if you just reinstalled the system on SD card, you can skip this step and go further to Mount your hard drive below, otherwise, please proceed with:
sudo fdisk /dev/sda
Enter until you exit out of the command. Then
q to exit to the command prompt.
sudo mkfs.ext4 /dev/sda
Mount your hard drive
sudo mkdir /mnt/storj sudo mount /dev/sda /mnt/storj sudo nano /etc/fstab
Then add this line to the end:
/dev/sda /mnt/storj ext4 defaults 0 2
Ctrl-O and confirm saving, then exit with
sudo chown -R pi:pi /mnt/storj
Add cgroup memory support (to prevent OOM hang of your Pi):
sudo nano /boot/cmdline.txt
cgroup_enable=memory cgroup_memory=1 swapaccount=1 to the end of the line. The resulting string should look like this:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=XXXXXX-XX rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cgroup_enable=memory cgroup_memory=1 swapaccount=1
Save the file (
Ctrl-X, confirm saving) and reboot:
Create your node Identity
You can create an identity directly on your Pi. It will take at least 24 hours. But you may prefer to create the identity on a more powerful desktop or laptop where identity creation would take a lot less time, and then move the identity files to the Pi.
Create a node Identity on your PI
Download the identity binary for the RPi: identity_linux_arm.zip
curl https://github.com/storj/storj/releases/latest/download/identity_linux_arm.zip -o identity_linux_arm.zip sudo apt-get install unzip unzip ~/identity_linux_arm.zip
Generate the Identity:
./identity_linux_arm create storagenode
Your identity will be generated here:
Create a node Identity on your desktop
Download the identity binary for your platform:
- Mac OS: identity_darwin_amd64.zip
- Linux: identity_linux_amd64.zip
- Windows 10 Pro: identity_windows_amd64.zip
Unpack the binary to the preferred folder. Let´s suppose it is your home folder.
Then generate the Identity (this example is for Windows ):
./identity_windows_amd64.exe create storagenode
Your Identity will be generated here:
%APPDATA%\Storj\Identity\storagenodeif you use a
Note. You can also specify to place the identity files into another folder using the option
Sign your node Identity
./identity_windows_amd64.exe authorize storagenode email@example.com:ohihioHiohohIOhUyTUfyufVJHvufUyvJHvyFTYdhVJGionOoHib
firstname.lastname@example.org:ohihioHiohohIOhUyTUfyufVJHvufUyvJHvyFTYdhVJGionOoHib is your authorization token you received in your invitation email.
We recommend to move your signed identity from the SD card to the HDD with the storagenode data. If the SD card fails, you will not lose your identity. In the event of a hard drive failure, your node would be lost anyway, so it is better to store identity and data together in different folders on the hard drive.
Note: You cannot authorize your identity if you have not received the invite email yet with your authentication token.
Note: The email address is a part of the auth token and should be copied including all characters.
Note: You can specify the identity folder with an
Copy your node Identity to the RPi
In case you generated and authorized your node Identity on a desktop/laptop computer instead of directly on the RPi to save time, you can copy it to the RPi afterward, as follows:
Copy the Identity to the RPi from Linux or Mac
Copy your node identity from your desktop to RPi: https://unix.stackexchange.com/questions/106480/how-to-copy-files-from-one-machine-to-another-using-ssh
Copy the Identity to the RPi from a Windows machine
Copy your node identity from your Windows machine to the RPi: https://unix.stackexchange.com/questions/92715/can-i-transfer-files-using-ssh
To install Docker on the RPi, be sure to use the following installation method:
curl -sSL https://get.docker.com | sh
Download Docker container with storagenode
docker pull storjlabs/storagenode:latest
In our example we will need to have port no. 28967 forwarded to our RPi. Use the steps for Linux OS from the article Need help port-forwarding? to perform port forwarding to your Raspberry Pi.
You can take a look at this article to learn how to install the no-ip software, if you have a dynamic public IP. Note that if you use the free version of no-ip, you will need to periodically renew it every month so it will continue working properly.
Please be sure to check that your port is open here: https://yougetsignal.com
Run a Docker container with storagenode
We recommend to create a subfolder for the storagenode on your disk, as this would prevent your node from starting in the event that the mount accidentally fails for any reason. We will assume further that this subfolder is called
Parameters used in the Docker run command:
WALLET: ERC20 compatible ethereum address for STORJ token payments
ADDRESS: external IP address or the DDNS you configured and the port you opened on your router.
Note: If you are using a custom port other than 28967, then you have to change the
STORAGE: how much disk space you want to allocate to the Storj network
- /home/pi/.local/share/storj/identity/storagenode: the location of your identity files. You can copy the absolute path from the output of the identity command you ran earlier (second to last line below). We recommend to move it to the HDD, for example, to the
/mnt/storj/storagenode/identity. In this case replace the string /home/pi/.local/share/storj/identity/storagenode to your actual path. It should contain 6 files belonging the identity.
- /mnt/storj/storagenode: local directory where you want files to be stored on your hard drive for the network.
Example of Docker run command:
docker run -d --restart always --stop-timeout 300 \
-p 28967:28967 \
-p 127.0.0.1:14002:14002 \ -e WALLET="0x0000…." \ -e EMAIL="email@example.com" \ -e ADDRESS="externaladdress:28967" \ -e STORAGE="2TB" \
--log-opt max-size=50m \
--log-opt max-file=10 \ --mount type=bind,source=/home/pi/.local/share/storj/identity/storagenode,destination=/app/identity \
--mount type=bind,source=/mnt/storj/storagenode,destination=/app/config \
--name storagenode storjlabs/storagenode:latest