Installing IRI on Linux

In order to install IRI, there are certain requirements to be considered. It should be noted that IRI only works on 64-bit architectures.
  • Ubuntu 18.04 LTS
  • Oracle JAVA 8 JRE
  • Minimum of 3GB of free system memory
  • 60GB of free disk space
  • Static IP
  • Firewall access for port forwarding

Node Installation

This will guide you through installing a node. The IRI code can be built locally or a prebuilt binary can be obtained for a faster setup. Both options will be presented below.

Install latest security patches

Ensure your system is secure before proceeding.
sudo apt-get update sudo apt-get upgrade -y

Install JAVA 8 JRE from Oracle

You will need to read and accept the license agreement to proceed with installation.
export JAVA_VERSION=8u171-1
sudo apt-get install -y software-properties-common --no-install-recommends
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java8-installer=${JAVA_VERSION}~webupd8~1 --no-install-recommends

Set JAVA 8 JRE as default

This ensures that the JAVA 8 JRE is the default JRE system wide.
sudo apt install oracle-java8-set-default

# Log out and back in, check that this is set by running the following command

echo $JAVA_HOME

Prebuilt IRI JAVA Archive

If you prefer not to build IRI from source, follow this step. Otherwise, proceed to the Build from Source step below.
Download the latest JAVA IRI archive on the node: https://github.com/iotaledger/iri/releases
As an example, to download the v1.5.1 release, run the following command:
wget https://github.com/iotaledger/iri/releases/download/v1.5.1/iri-1.5.1.jar

Build From Source

This step is not required, you can skip ahead to the section Running the Node if you have used the prebuilt JAVA archive.

Install Maven

Maven is the build system used to build the IRI sources.
export MAVEN_VERSION=3.5.3
export USER_HOME_DIR="/root" (Set this path correctly for your user)
export SHA=b52956373fab1dd4277926507ab189fb797b3bc51a2a267a193c931fffad8408
export BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
sudo apt-get update && apt-get install -y --no-install-recommends curl
sudo mkdir -p /usr/share/maven /usr/share/maven/ref
sudo curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz

# Check the sha256 checksum, should say OK if the checksum matches

echo "${SHA} /tmp/apache-maven.tar.gz" | sha256sum -c -
sudo tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1
sudo rm -f /tmp/apache-maven.tar.gz
export MAVEN_HOME=/usr/share/maven
export MAVEN_CONFIG="$USER_HOME_DIR/.m2"

Install GIT

GIT is used as the version control system used to fetch the IRI source.
sudo apt-get update && apt-get install -y --no-install-recommends git

Build IRI

Build the IRI archive.
git clone https://github.com/iotaledger/iri.git
cd iri

# Checkout the latest tag

export TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git checkout $TAG
mvn clean package

An IRI JAVA archive (jar) has now been build in the "target" directory.

Running the Node

Start the IRI node.
  • Note: IRI_JAR_PATH must be the full path to the IRI JAVA archive. If you have built from source, then archive will be output in the target directory.
export IRI_JAR_PATH=$pwd/target
export JAVA_OPTIONS="-XX:+UnlockExperimentalVMOptions -XX:+DisableAttachMechanism -XX:InitiatingHeapOccupancyPercent=60 -XX:G1MaxNewSizePercent=75 -XX:MaxGCPauseMillis=10000 -XX:+UseG1GC"
export JAVA_MIN_MEMORY=2G
export JAVA_MAX_MEMORY=4G

# This path needs to adjusted for your local machine

export IRI_JAR_PATH="$(pwd)/target/iri*.jar"
mkdir -p /srv/iri/data
cd /srv/iri/data
java $JAVA_OPTIONS -Xms$JAVA_MIN_MEMORY -Xmx$JAVA_MAX_MEMORY -Djava.net.preferIPv4Stack=true -jar $IRI_JAR_PATH --remote -p 14265

Port Mapping

IRI by default uses three ports. These ports need to be mapped to machine from an external static IP address.
  • UDP neighbor peering port (default is 14600)
  • TCP neighbor peering port (default is 14600)
  • TCP API port (default is 14265)

Checking the Node Status

Using curl and jq you can test the TCP API port.
sudo apt install -y curl jq
curl -s `http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1' -H 'Content-Type: application/json' -d '{"command": "getNodeInfo"}'` | jq

Configuring the Node

The node can be configured by passing command line arguments to the IRI jar when invoked, however a configuration file can also be used.
# Create an INI file like the one below, lets say iri.ini
[IRI]
PORT = 14265
UDP_RECEIVER_PORT = 14600
NEIGHBORS = udp://my.favorite-iri-node.com:14600
IXI_DIR = ixi
DEBUG = false
DB_PATH = db`

Now pass -c iri.ini to the IRI jar when invoking:
java $JAVA_OPTIONS -Xms$JAVA_MIN_MEMORY -Xmx$JAVA_MAX_MEMORY -Djava.net.preferIPv4Stack=true -jar $IRI_JAR_PATH --remote -p 14265 -c iri.ini
The configuration will be read from disk.

Finding Neighbours

In order to allow your node to sync the tangle, you must find neighbours for your node. Once you have found and configured neighbors for your node, they must manually approve your node before the syncing will take place.
Please follow the link below for more details.
Finding Neighbours