| #IOTA, #Ubuntu

How to setup a IOTA fullnode on Ubuntu 16.04

some tips on how to deploy a fullnode

This is not a complete "how to setup my server from scratch" tutorial. Appropriate measures to secure your server against attacks have still to be taken.

The following shows how I setup my IOTA fullnode on Ubuntu 16.04. The same may apply to similar linux distributions.

Create a directory for the iri

~$ mkdir iota/
~$ cd iota

IRI

Download the latest iri release from GitHub

~/iota$ wget https://github.com/iotaledger/iri/releases/download/<version>/iri-<version>.jar -O iri.jar   

create a config file

~/iota$ nano config.ini 

and paste the following content

[IRI]
PORT = 14265
UDP_RECEIVER_PORT = 14600
TCP_RECEIVE_PORT = 15600
NEIGHBORS = tcp://<neighbour1>:15600 udp://<neighbour12:14600
IXI_DIR = ixi
HEADLESS = true
;DEBUG = true
DB_PATH = db
;ZMQ_ENABLED = true
;REVALIDATE = true
;RESCAN_DB = true

add space separated neighbors next to the NEIGHBORS key. Use ; for comments.

Oracle Java

Oracles java is optional, but recommended. Add the PPA

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update      

install the JDK 8

$ sudo apt-get install oracle-java8-installer

select the appropriate version if you have multiple java versions installed.

$ sudo update-alternatives --config java      

Deamon init script

To start the iri on startup and automatically restart it on crash, a .service file is needed.

$ sudo nano /etc/systemd/system/iota.service     

adapt and paste the following data:

[Unit]
Description=IOTA node
After=network.target

[Service]
WorkingDirectory=/home/<username>/iota/
ExecStart=/usr/bin/java -Xmx6g -Xms4g -jar iri.jar -c config.ini
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target   

-Xmx6g is the max RAM the iri can use. -Xms4g the startup RAM.

Reload the deamon config after saving the .service file

$ sudo systemctl daemon-reload

enable the service on startup

$ sudo systemctl enable iota

start it

$ sudo systemctl start iota

monitor the iri's output

$ sudo journalctl -u iota -f

-u to select the service, -f to follow the logs.

Firewall

Allow port 15600/tcp and 14600/udp if you use the default ports in the config.ini. When using ufw:

$ sudo ufw allow 15600/tcp
$ sudo ufw allow 14600/udp

Update the IRI

Monitor Status

The IOTA Peer Manager is a nice tool to monitor the connection status of your nodes' neighbors. To run the IPM, Nodejs is needed

$ apt-get update
$ apt-get install nodejs

install the IPM

$ npm i -g iota-pm

create a service

$ sudo nano /etc/systemd/system/iota-pm.service 

paste the following

[Unit]
Description=Node.js IOTA Peer Manager

[Service]
ExecStart=/usr/bin/nodejs /usr/local/lib/node_modules/iota-pm -i http://127.0.0.1:14265 -r 5
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs

[Install]
WantedBy=multi-user.target

reload and enable the service

$ sudo systemctl daemon-reload
$ sudo systemctl enable iota-pm
$ sudo systemctl start iota-pm

from your local machine open a ssh tunnel to view the dashboard

ssh username@server -L -N 8080:localhost:8888

8080 is the local port on which the ipm dashboard can be viewed http://localhost:8080. 8888 the ipm's port on the remote machine.

Debug

Known Issues

← Arduino as ISP to change the bootloader and burn sketches