read

This tutorial will show you how to set up a supernode for NEM on a VPS with Debian 8.4 via the command line in three steps.

Also take a look at:

Command Line Knowledge

We are going to use vim as our text editor. You can also use nano if you are more familiar with it.

For a basic vim tutorial visit:

English:

German:

Hardware & Software Requirements

You will need a VPS that fulfills the following requirements:

  • RAM: At least 1GB recommended (at least 768MB to NIS and 128MB to the servant)
  • CPU: 1Ghz+ single core or more is recommend
  • Upstream: at least 5mbps
  • Open inbound/outbound TCP ports for 7778, 7880, and 7890 on firewalls and routers
  • Debian 8.4 minimal
  • Root access via SSH

Hosting recommendations:

1. Installation

You will need to access your server as the root user:

ssh root@YOUR-SERVER-IP  

If you use Amazon AWS, visit: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html

Depending on your Linux distribution, you might not log in with root@YOUR-SERVER-IP. In that case, once you are logged in with a different user type su -i to log in as the root user.

1.1. Create a swap file

If your host does not allow creating a swap file you can advance to section 1.2. but in this case I would recommend using a VPS with 2GB of RAM.

You can also skip this step if free -h shows you that a swap file already exists.

Change count to the size of your RAM. In my case my VPS has 1GB of RAM so I choose 1048576.

su  
dd if=/dev/zero of=/swapfile bs=1024 count=1048576  
chmod 600 /swapfile  
mkswap /swapfile  
swapon /swapfile  
cp /etc/fstab /etc/fstab.bak  
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab  

1.2. Install Java 8

su  
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list  
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list  
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886  
apt-get update  
apt-get install oracle-java8-installer  

1.3. Download and configure NIS

Visit http://bob.nem.ninja/ to check for the latest nis-ncc url.

wget http://bob.nem.ninja/nis-ncc-0.6.77.tgz  
tar -xvzf nis-ncc-0.6.77.tgz  
rm nis-ncc-0.6.77.tgz  
mkdir nis-ncc  
mv package nis-ncc/package  

Using vim we are going to create a custom config file. If it is not installed follow these commands:

sudo apt-get update  
sudo apt-get install vim  

And then continue:

cd nis-ncc  
vim config-user.properties  

Create one entry for nis.bootKey with your delegated private key. One entry for nis.bootName with your node's public name and one entry for nis.shouldAutoHarvestOnBoot withthe value true.

Once you have made your changes press Esc and type the following to save and exit the file (using vim):

:wq
cp package/nix.runNis.sh nisStart.sh  
vim nisStart.sh  

We are going to limit the memory usage for NIS to 768MB and change the paths. To edit press i:

Once you have made your changes press Esc and type the following to save and exit the file (using vim):

:wq
chmod +x nisStart.sh  
./nisStart.sh

Let NIS run for a minute then quit it by pressing Ctrl-c. This will create the required folder structure for the next step.

cd  

Visit http://bob.nem.ninja/ to check for the latest database dump url.

wget http://bob.nem.ninja/nis5_mainnet-681k.h2.db.zip  
apt-get install unzip  
unzip nis5_mainnet-681k.h2.db.zip  
rm nis5_mainnet-681k.h2.db.zip  
mv nis5_mainnet.h2.db nem/nis/data/  

1.4. Download and configure the servant

Visit http://bob.nem.ninja/ to check for the servant url

wget http://bob.nem.ninja/servant_0_0_4.zip  
unzip servant_0_0_4.zip  
rm servant_0_0_4.zip  
mkdir supernode-servant  
mv servant supernode-servant/servant  
cd supernode-servant  
vim config-user.properties  

Create one entry for nem.host with your static IP or host name and one entry for servant.key with your delegated private key.

Once you have made your changes press Esc and type the following to save and exit the file (using vim):

:wq
cp servant/startservant.sh servantStart.sh  
vim servantStart.sh  

We are going to limit the memory usage for the servant to 128MB and change the paths:

Once you have made your changes press Esc and type the following to save and exit the file (using vim):

:wq
chmod +x servantStart.sh  

1.5. Download and set up the supernode starter service

cd  
wget https://github.com/PaulRieger/supernode-service/archive/master.zip  
unzip master.zip  
rm master.zip  
chmod +x supernode-service-master/supernodeStart.sh  
mv supernode-service-master/supernode.service /etc/systemd/system/  
systemctl enable supernode.service  

2. Run

reboot  

Wait a few seconds, then:

ssh root@YOUR-SERVER-IP  

To see the log outputs, check:

tail -f nem/nis/logs/nis-0.log  

and

tail -f nem/node-rewards/servant/logs/servant-0.log  

If everything is set up correctly, you can visit YOUR-SERVER-IP:7890/node/extended-info to see information about your node.

3. Enroll your supernode

Send a NEM message to

NAFUNDBUKIOSTMD4BNXL7ZFE735QHN7A3FBS6CMY  

with the following message:

enroll YOUR-SERVER-IP YOUR-NODE-NAME YOUR-DELEGATED-PUBLIC-KEY  

Please make sure to send the delegated public key and not the private key that you used earlier in this tutorial.

Your node will show up at supernodes.nem.io after a few hours. If your node passes the last four tests during a day it will be included in the next rewards payout.tail -f nem/nis/logs/nis-0.log

4. Update Guide

ssh root@YOUR-SERVER-IP  
cd nis-ncc  

Remove the old package folder:

rm -rf package  

Get the newest version:
Visit http://bob.nem.ninja/ to check for the latest nis-ncc url.

wget http://bob.nem.ninja/nis-ncc-0.6.79.tgz  
tar -xvzf nis-ncc-0.6.79.tgz  
rm nis-ncc-0.6.79.tgz  

Reboot the node to restart everything:

reboot  

The NEM team would like to thank Paul for writing this tutorial. If there are any questions, they can be discussed here.

Blog Logo

A Nember


Published


Image

NEM

Official Blog of NEM/XEM

Back to Overview