on Jan 25, 2019
by Simone

Install and configure an IoTeX full-node on Ubuntu 18.04

Despite of the complex architecture of the IoTeX Blockchain, installing and configuring a full node is really easy. Once you've got a full node running on your IoT device, it will be immediately enabled to interact with other devices on the IoTeX blockchain, leveraging all the benefit of a secure, scalable, and privacy-centric network.

Prerequisite: Installing Ubuntu 18.06

Our tutorial is based on a clean installation of Ubuntu Desktop 18.04, if you don't know how to install it, there are many step by step guide available online, here is one: Ubuntu 18.04 LTS Desktop Installation Guide with Screenshots

Prerequisite: Installing Docker

First, update your existing list of packages:

sudo apt update

Next, install a few prerequisite packages which let apt use packages over HTTPS

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add the GPG key for the official Docker repository to your system:

curl -fsSL | sudo apt-key add -

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] bionic stable"

Next, update the package database with the Docker packages from the newly added repo:

sudo apt update

Finally, install Docker:

sudo apt install docker-ce

Docker should now be installed, the service started, and the process enabled to start on boot. Check that it's running:

sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

docker.service - Docker Application Container Engine   
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-07-05 15:08:39 UTC; 2min 55s ago
Docs: Main PID: 10096 (dockerd) Tasks: 16 CGroup: /system.slice/docker.service

Installing the full node

If you want to learn more, you can find the official IoTeX documentation, including the SDK API at the following link:

Download the docker image of the full node

docker pull iotex/iotex-core:v0.4.2

Move to your home directory

cd ~

Download the config file for the full node

curl > config_fullnode.yaml

Edit the config file with your public ip address
press Ctrl+X then press Y, ENTER to save and close

nano config_fullnode.yaml

Run the full node image in a docker container
Remember to adapt the command with your linux username

sudo docker run --name testnet -d -p 30555:30555 -p 30100:14004 --mount type=bind,source=/home/your_username/config_fullnode.yaml,target=/etc/iotex/config_local_fullnode.yaml iotex/iotex-core:v0.4.2

Check that the container is running

docker container ls

Pull the logs from the running container
press Ctrl+C to stop the logging output

docker logs --follow --tail 100 testnet

If you want to pause the container execution, here is the command

docker container stop testnet

And if you want to resume the execution:

docker container start testnet