Setting up a VPS IOTA Full Node from scratch!


Author
Message
Carpincho
Carpincho
Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)
Group: Forum Members
Posts: 23, Visits: 25
Introduction

In this tutorial I will guide you step by step to install and run a headless Full Node for the IOTA network using the latest stable IRI release and a Virtual Private Server (VPS). We will also install iota-pm, in order to have a dashboard to control our neighbors perfomance. I will be using Debian 9 in my local machine and in the VPS. If you use other OS such as Windows, you can download a ssh tool such as putty to connect to your remote server and run the commands we will cover. It should be just the same.


Getting a VPS

A Virtual Private Server is a virtual machine based server that allows you to connect and work on a given operating system as if it were a dedicated computer. You will be accesing the server and installing stuff from the scratch on a Debian 9 Linux distribution. Ubuntu and other Debian derivated should be pretty similar -if not the same.

For this tutorial we will be using a Contabo VPS with 4 CPU cores, 12 GB RAM and 300 GB of SSD storage. As I write this, that plan costs 8.99 Euros.

Once we finished paying for the VPS, we will receive our public IP and the root password to login to the box via ssh. So, lets start there. We will access create a directory for our node and install some packages that will be needed such as Git, Maven, and others.

Starting the setup

We will be assumming that my public IP Address is 173.212.193.00. Last numbers are not shown because this is actually a Full Node I will be running.



To start let’s go to the /opt directory. Once we are there, we will install Git, Maven and Java 8. For get this done, we will use the following commands. Note that everytime you run apt install command you will be prompted to chose if you wanna install the pck or not. Just enter Y and hit enter.

root@vmi152766:/# cd /opt
root@vmi152766:/opt# apt install git
root@vmi152766:/opt# apt install maven
root@vmi152766:/opt# apt install default-jre
root@vmi152766:/opt# apt install default-jdk


If everything went fine, you should be able to see what java version you have installed by typing the following command.


We are now ready to start working with the IOTA IRI. Let’s clone the iotaledger Github IRI in our ot folder to get the latest version. Once we clone the repo a new iri folder will be created in /opt. We will compile the IRI and build the package with the following commands.

root@vmi152766:/opt# git clone https://github.com/iotaledger/iri
root@vmi152766:/opt# cd iri
root@vmi152766:/opt/iri# mvn clean compile
root@vmi152766:/opt/iri# mvn package


After executing this commands a new folder called target will be created. Inside that folder we are going to find our executable IRI with this name iri-1.4.1.2.jar


If everything went fine, we should be able to run our node to test it. We still have no neighbors so we will just try starting it up to see if we are fine and then we will stop it with ctrl + c.

root@vmi152766:/opt/iri# cd target
root@vmi152766:/opt/iri/target# java -jar iri-1.4.1.2.jar -p 14265




Because we will need to pass some arguments to the IRI (such as the port in the example), we will create a configuration file and place all the parameters in there. Once we have our config, we will be able to run the node only passing that config file as argument. Let’s create a config file called iri.ini inside the target folder and place in there the values we will need to have. We will be using nano, a command line based text editor. All you need to know is that you can create a new file by typing nano newfile.txt. To save the file contents you do ctrl + o. To exit the file and get back to the terminal you hit ctrl + x.

root@vmi152766:/opt/iri/target# nano iri.ini


Lets see a little what we are going to include in this file.

[IRI]
PORT = 14265
UDP_RECEIVER_PORT = 14600
TCP_RECEIVER_PORT = 15600
NEIGHBORS = udp://neighbor-1:14600 udp://neighbor-2:14600
IXI_DIR = ixi
HEADLESS = true
DEBUG = true
DB_PATH = mainnetdb
API_HOST = 173.212.193.00


Note that in here you must list your neighbors. In order to have a fully working node you need to exchange your full node address with other users (called neighbors). Only once you add a neighboar to the list and that neighbor do the same with your node, you have a valid pair. It’s very important to have stable dedicated neighbors if you want your Full Node to sync and work properly. So it’s a two way process. You can look for neighbors in the #nodesharing Slack channel.

Neighbors

According to Come From Beyond, it’s better to have 3 or 4 neighbors working fine that a lot that wont run their nodes 24/7. The maximum number of neighbors should be 7. So go to the #nodesharing slack channel and start seeking for neighbors. They will give you their address (udp://143.22.33.43:14600, for instance) and you will have to give them yours (which is udp://173.212.193.00:14600)

Everytime you need to add a new neighbor you must stop your Full Node, edit the iri.ini, add the address leaving a space between addresses, save the file (ctrl + o) and exit (ctrl + x). Finally you restart your node .

Once you have your config file ready, you just start the Full Node again with the command used before and the -c iri.ini as only argument. This will run your node using all the settings described in that config file. If your neighbors are working fine you will eventually start getting some data.

root@vmi152766:/opt/iri/target# java -jar iri-1.4.1.2.jar -c iri.ini




Checking your node’s API endpoint

Before you proceed installing some Graphic tool to monitor your and yours neighbors nodes, you should permorm a test to see if your running node has a reachable API. This can be done by using curl as described in the IRI API Reference Guide. My node IP is 173.212.193.00 so, its API should be reachable at http://173.212.193.00:14265. In order to check this we will run this Curl command in the terminal.

curl http://173.212.193.00:14265 \
-X POST \
-H 'Content-Type: application/json' \
-H 'X-IOTA-API-Version: 1' \
-d '{"command": "getNodeInfo"}'


If everything went fine we should get a response of this type.



Setting up a Graphic Interface to control your Full Node

So far we have our node running and we can see the data as it goes down in the terminal. This is not very practical, specially if you wanna have an overview of how your neighbors nodes are working and how is your sync doing. In order to have a tool that makes all this easy we will install iota-pm. This node.js tool will give us a public point to access our Full Node via our browser.

Lets install Curl, node.js and nmp in order to get this wonderfull tool working.

root@vmi152766:/opt# apt install curl
root@vmi152766:/opt# curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
root@vmi152766:/opt# apt install nodejs
root@vmi152766:/opt# npm i -g iota-pm


And that’s all! Now, we have our Peer Manager installed. In order to start it and be able to see our dashboard from the browser we must use the following command.

root@vmi152766:/opt# iota-pm -i http://173.212.193.00:14265 -p 173.212.193.00:8888


Once the command is running you can just to your browser and point to http://173.212.193.00:8888 to see a nicely designed dashboard.



Final considerations

Full Nodes are useful for helping IOTA network to get stronger only if they are running 24/7, in good shape and with neighbors performing reasonable fine. Add some neighbors to see how good they are doing and clean your neighbors list to only keep the ones that are almost up and have good permormance.

When you start running your node, you will have to go though the get in sync process. This can take hours or days depending on your node performance and your neighbors health as well. If you are deleting addresses from your neighbor config section, let them know so they can also remove you.

Sometimes is best to run the Node and iota-pm commands as background tasks, so you can close your terminal without interrupting them. This can be achieved by using nohup and the ampersand at the end. For example:

root@vmi152766:/opt/iri/target# nohup java -jar iri-1.4.1.2.jar -c iri.ini &
root@vmi152766:/opt# nohup iota-pm -i http://173.212.193.00:14265 -p 173.212.193.00:8888 &


Finally, you can easily check if your iri and iota-pm are running by using the ps ax command, which lists all the processes running at the time in the machine.



Source: http://www.iotahispano.com/setting-up-a-vps-iota-full-node-from-scratch/iota-pm








Edited Last Month by Winston
Winston
Winston
Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)
Group: Administrators
Posts: 2,3K, Visits: 4,0K
@Carpincho Beautiful. Pinned to the top of this forum.

IOTA
Carpincho
Carpincho
Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)
Group: Forum Members
Posts: 23, Visits: 25
Winston - 4 Dec 2017
@Carpincho Beautiful. Pinned to the top of this forum.

IOTA

Thanks! Everyone can setup a Full Node just be following those steps. I hope it helps!
Carpincho
Carpincho
Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)
Group: Forum Members
Posts: 23, Visits: 25
Spotted some errors but I cant edit the post. The command to run the processes in the background is nohup instead of nohub. So it should be:
root@vmi152766:/opt/iri/target# nohup java -jar iri-1.4.1.2.jar -c iri.ini &
root@vmi152766:/opt# nohup iota-pm -i http://173.212.193.00:14265 -p 173.212.193.00:8888 &

Winston
Winston
Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)
Group: Administrators
Posts: 2,3K, Visits: 4,0K
@Carpincho Thanks, I edited it for you. We have the forum set to prevent edits after some fixed time period.
Carpincho
Carpincho
Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)
Group: Forum Members
Posts: 23, Visits: 25
Thanks! There a lot of typos that I fixed in the Source but commands are fine so the guide should serve its purpose!
Winston
Winston
Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)Forum Admin (28,0K reputation)
Group: Administrators
Posts: 2,3K, Visits: 4,0K
Carpincho - 5 Dec 2017
Thanks! There a lot of typos that I fixed in the Source but commands are fine so the guide should serve its purpose!

@Carpincho Please DM me (either here or on slack) with those updates, and I'll edit them in. This guide is amazing, so I definitely want to prioritize the curation of your great work here.
inhisservice4
i
Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)Attaching to Tangle (51 reputation)
Group: Forum Members
Posts: 3, Visits: 0
Thanks guys, I built this. here is mine. http://198.187.30.126:8888/.
Any idea how to get this to work with a DNS hostname. I want it to resolve with my hostname miotanode.com.

Thanks!
buy-IOTA
b
Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)Attaching to Tangle (33 reputation)
Group: Forum Members
Posts: 3, Visits: 0
Cool. I am going to do that today!

http://buy-iota.ml
happydrummer
h
Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)Attaching to Tangle (29 reputation)
Group: Forum Members
Posts: 5, Visits: 0
This is awesome - thanks so much for the simple guide. the GUI is great too
AIdj
AIdj
Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)Attaching to Tangle (70 reputation)
Group: Forum Members
Posts: 6, Visits: 1
Thx for useful tutorial 
Im newbie I would like to keep this post but i dont know how to do


ionta
i
Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)Attaching to Tangle (1 reputation)
Group: Forum Members
Posts: 1, Visits: 0
Hi, I get the following error when I try to run the visual interface. I installed the node following these instructions first: http://iota.partners/ -
Then I found your post and tried running the visual interface

Serving IOTA peer dashboard at http://94.130.229.186:8888
events.js:160
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRNOTAVAIL 94.130.229.186:8888
  at Object.exports._errnoException (util.js:1020:11)
  at exports._exceptionWithHostPort (util.js:1043:20)
  at Server._listen2 (net.js:1249:19)
  at listen (net.js:1298:10)
  at net.js:1408:9
  at _combinedTickCallback (internal/process/next_tick.js:83:11)
  at process._tickCallback (internal/process/next_tick.js:104:9)
  at Module.runMain (module.js:606:11)
  at run (bootstrap_node.js:383:7)
  at startup (bootstrap_node.js:149:9)

Edited Last Month by ionta
jayjay
j
Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)
Group: Forum Members
Posts: 2, Visits: 0
it's better to use Oracle Java and not the OpenJDK, as there can some errors occur with OpenJDK.

You can install it like this:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

it's better to uninstall the OpenJDK first

Edited Last Month by jayjay
lindbergio
l
Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)
Group: Forum Members
Posts: 4, Visits: 0
adamglatt - 9 Dec 2017
I'm getting the following error.  I've asked in the #help room on slack, but only found others with the same issue (following this guide), so hoping maybe it's as simple as an omitted step?


ERROR com.iota.iri.IRI - Exception during IOTA node initialisation:
java.lang.RuntimeException: java.net.BindException: Cannot assign requested address
  at io.undertow.Undertow.start(Undertow.java:203) ~[iri-1.4.1.2.jar:na]
  at com.iota.iri.service.API.init(API.java:156) ~[iri-1.4.1.2.jar:na]
  at com.iota.iri.IRI.main(IRI.java:87) ~[iri-1.4.1.2.jar:na]
Caused by: java.net.BindException: Cannot assign requested address
  at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_151]
  at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_151]
  at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_151]
  at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_151]
  at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_151]
  at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:190) ~[iri-1.4.1.2.jar:na]
  at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243) ~[iri-1.4.1.2.jar:na]
  at io.undertow.Undertow.start(Undertow.java:163) ~[iri-1.4.1.2.jar:na]
  ... 2 common frames omitted


Change the API_HOST variable to reflect your servers address in the iri.ini file.

Edited Last Month by lindbergio
lindbergio
l
Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)
Group: Forum Members
Posts: 4, Visits: 0
I would suggest running the applications using systemd service files instead of nohup. This will make it possible to start the applications on boot and makes for a better handling of the applications.

Here is the systemd service file I use for iri:
[Unit]
Description=Iri
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/iri/target
ExecStart=/usr/bin/java -jar iri-1.4.1.2.jar -c iri.ini
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target

Here is the systemd service file I use for iota-pm (collected from https://github.com/akashgoswami/ipm/blob/master/systemd/iota-pm.service):
[Unit]
Description=IOTA Peer Manager
After=network.target

[Service]
#User=iota
#Group=iota
Type=simple
ExecStart=/usr/bin/iota-pm -i http://127.0.0.1:14265 -p 127.0.0.1:8888
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target

Please come with suggestions to improve the systemd service files as I'm no expert.

Change the API endpoint and the local server ip and port to reflect your setup.
lindbergio
l
Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)
Group: Forum Members
Posts: 4, Visits: 0
jayjay - 8 Dec 2017
it's better to use Oracle Java and not the OpenJDK, as there can some errors occur with OpenJDK.

You can install it like this:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

it's better to uninstall the OpenJDK first

No, no! Please don't mix in more external repositories and especially not ppa's. Iri is working fine with openJDK/openJRE.

Don't Break Debian
lindbergio
l
Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)Attaching to Tangle (4 reputation)
Group: Forum Members
Posts: 4, Visits: 0
Carpincho - 4 Dec 2017
root@vmi152766:/opt# apt install default-jre
root@vmi152766:/opt# apt install default-jdk[/code]

Please change these to the headless versions of the packages (to avoid mixing in X11):
# apt install default-jre-headless
# apt install default-jdk-headless



jayjay
j
Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)Attaching to Tangle (2 reputation)
Group: Forum Members
Posts: 2, Visits: 0
lindbergio - 10 Dec 2017
jayjay - 8 Dec 2017
it's better to use Oracle Java and not the OpenJDK, as there can some errors occur with OpenJDK.

You can install it like this:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

it's better to uninstall the OpenJDK first

No, no! Please don't mix in more external repositories and especially not ppa's. Iri is working fine with openJDK/openJRE.

Don't Break Debian

Ask the devs, they also recommend to use Oracle Java
Carpincho
Carpincho
Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)
Group: Forum Members
Posts: 23, Visits: 25
lindbergio - 10 Dec 2017
Carpincho - 4 Dec 2017
root@vmi152766:/opt# apt install default-jre
root@vmi152766:/opt# apt install default-jdk[/code]

Please change these to the headless versions of the packages (to avoid mixing in X11):
# apt install default-jre-headless
# apt install default-jdk-headless


Lindbergio, unfortunately some minutes after creating this Post I was no longer able to Edit it so it has lot's of errors and missing last steps such as the download of a 30 minutes old mainnetdb which allows to sync via rescan in some minutes. I will add all this stuff to the source and then maybe create a new Post. Regarding your corrections, I should try them. This steps are working with a Fresh Debian 9 VPS. I did this routine enough so as to be sure that following this steps you get a running FN with IOTA-PM. Let me try those packages instead of the ones I used and if they go smooth I will consider the change. 

Thanks!

Carpincho
Carpincho
Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)Attaching to Tangle (150 reputation)
Group: Forum Members
Posts: 23, Visits: 25
lindbergio - 10 Dec 2017
I would suggest running the applications using systemd service files instead of nohup. This will make it possible to start the applications on boot and makes for a better handling of the applications.

Here is the systemd service file I use for iri:
[Unit]
Description=Iri
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/iri/target
ExecStart=/usr/bin/java -jar iri-1.4.1.2.jar -c iri.ini
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target

Here is the systemd service file I use for iota-pm (collected from https://github.com/akashgoswami/ipm/blob/master/systemd/iota-pm.service):
[Unit]
Description=IOTA Peer Manager
After=network.target

[Service]
#User=iota
#Group=iota
Type=simple
ExecStart=/usr/bin/iota-pm -i http://127.0.0.1:14265 -p 127.0.0.1:8888
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target

Please come with suggestions to improve the systemd service files as I'm no expert.

Change the API endpoint and the local server ip and port to reflect your setup.

This is definitely a missing part together with the download of the 30 minutes old mainnetdb. Will add in next post
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Login

Explore
Messages
Mentions
Search