Set up Storj Share Farming Node on Ubuntu 16.04

Storj is decentralized cloud storage service. You can store your important files securely on its p2p network for a very cheap price. You can also rent your hard drive space to Storj p2p network, which is called farming. I’m going to show you how to set up Storj Share farming node on Ubuntu 16.04.

I’ll be using a DigitalOcean droplet, one of my recommended cloud VPS providers for this tutorial. But this tutorial will work on any Ubuntu 16.04 server, desktop or Raspberry Pi. Just hit CtrlAlt + T on your keyboard to launch CLI if you’re in Ubuntu Desktop.

Requirements Set up Storj Share Farming Node on Ubuntu 16.04

Storj Share is a node.js application. It also requires Python and GCC/G++/Make. But before installing any of that, let’s start by synchronizing your clock. Open Ubuntu command line as root and run following command to install ntp.

apt install ntp ntpdate -y

Sync your time with time.nist.gov,

service ntp stop
ntpdate -s time.nist.gov
service ntp start

Doing so will set your timezone to UTC. Confirm it by running following command.

timedatectl status

Now install Git, Python and build dependencies,

apt install git python build-essential

Storjshare daemon will use few ports to communication with its network. Let’s open them now while we’re still in the root account.

ufw allow 4000:4003/tcp
ufw allow 4000:4003/udp

Two commands above will open port 4000, 4001, 4002 and 4003 on both tcp and udp protocols. You can change them as you wish. If you’re setting up multiple nodes on you system, you need to use unique ports for each node. So remember to open them for each node.

Next we need to install node.js and a package manager. We should do it with a non-root user. Following command will add a user called vpsfix to your system.

adduser vpsfix

You’ll be asked for a password and few other information about the user. We’re not giving this user sudo privileges as we’re not going to need it. Type following command to login to new user account.

su vpsfix

We’ll now install nvm from official install script. Check for the newest version here and change the command accordingly.

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Logout of vpsfix account by typing exit and log back in as vpsfix again. Executing following command will install node.js on your system.

nvm install --lts

That completes the requirements to set up Storj Share farming node on Ubuntu 16.04.

Install Storj Share Daemon on Ubuntu 16.04

This part is a piece of cake. Running following command will install Storj Share daemon on your system.

npm install --global storjshare-daemon

Start the daemon,

storjshare daemon

Storj Share daemon will be running on the background now. You can run following command to get a list of Storj Share daemon commands.

storjshare --help

Your system is now ready to rent hard drive space to the Storj p2p network.

Create Storj Farming Node on Ubuntu 16.04

You need to set up a farming node in order to rent your space. You can read more about farming node configuration on official documentation. Let’s create a directory for our farming node.

mkdir node

That command will create a new directory inside vpsfix‘s home directory. Full path to the directory will be.

/home/vpsfix/node

This will be the directory you’re renting to Storj network. Following is a sample command to create a Storj Share configuration file. Don’t run it yet. You need to make few changes to it.

storjshare create --storage /home/vpsfix/node --storj 0xA3bB7c1a410b126B7f81e9A48793E0499eBc64d5 --size 100GB --rpcaddress xx.xx.xx.xx --rpcport 4000 --manualforwarding --tunnelportmin 4001 --tunnelportmax 4003 --outfile .config/storjshare/configs/node.json --noedit

Let’s look at the options we used in that command.

  • storage – This is the storage location on your system
  • storj – This is your Ether address
  • size – Amount of disk space you’re willing to rent
  • rpcaddress – Your IP address or hostname. More info here
  • rpcport – Which port number the node should use
  • manualforwarding – do not use nat traversal strategies
  • tunnelportmin & –tunnelportmax – Gateway port range
  • outfile – Configuration file location
  • noedit – do not open generated config in editor

If your Ubuntu username is vpsfix like mine, you only need to change storj, size and rpcaddress on the above command for it to work. It’ll create a configuration file named node.json in Storj Share config directory,

/home/vpsfix/.config/storjshare/configs

You can open this file later with nano text editor and make changes as you wish with following command. Just remember stop your node before making any changes.

nano /home/vpsfix/.config/storjshare/configs/node.json

Once the config file is generated, you can start node with following command.

storjshare start --config .config/storjshare/configs/node.json

It’ll take few minutes for your node to connect to Storj network. You can check the status with following command,

storjshare status

That command will display your node id. Which you can use to stop your node if needed,

storjshare stop -i node-id

And that’s it. I hope you’ll be able to set up Storj Share farming node on Ubuntu 16.04 with these instructions. Next you can create a bash script to start storjshare node at system reboot. Feel free to create a topic on out server administration forums if you face errors with this setup.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button