Running a full open node on a Linux server

From DigiByte Wiki
Revision as of 07:06, 24 August 2019 by Backseating (talk | contribs)
Jump to navigation Jump to search

These instructions will explain how to run a full open DigiByte node on a Linux server. These are all command line based, so no GUI is required. Ideal to turn your Web Site Server or Email server into a DigiByte full node server.

Separate instructions will become available of how to install a node and optionally the wallet on a Linux Desktop machine.

Basic Linux system administration knowledge is assumed and you may need to install additional packages if an error is encountered.

System Requirements

Most Linux distributions are either a Debian (ie Ubuntu) or a Redhat (ie CentOS) variant. Most commands are the same, but where there are differences it will be mentioned.

The server needs at least 4GB of RAM and 40 GB disk space to be able to operate smoothly.

Swap space

If you are using the minimum of 4GB of memory, it is recommended to have at least 8GB of swap space available. To check the current swap run the free command.

$ free -hm

To add 8GB of swap space, run the following commands as root user.

# fallocate -l 8G /swap
# chmod 0600 /swap
# mkswap /swap
# swapon /swap

Then verify if the swap has been added.

$ free -hm

To make this swap permanent after every boot, edit the file /etc/fstab and add the line:

/swap swap swap defaults 0 0

Create user

If not already exists, create a user name digibyte as root user.

CentOS:

# useradd -G wheel digibyte -m -s /bin/bash

Ubuntu:

# useradd -G sudo digibyte -m -s /bin/bash

Set the password for the new user.

# passwd digibyte

Logon as user digibyte.

# su - digibyte

 

Create a DigiByte configuation file

Execute this command to create a basic DigiByte configuration file. As we are running on a server, there is no need for the wallet and is disabled.

$ cat <<EOF > ~/.digibyte/digibyte.conf
server=1
listen=1
daemon=1
maxconnections=150
disablewallet=1
EOF

Install DigiByte software

Execute these commands to retrieve and unpack the DigiByte software. If you run on the ARM architecture, you will need to use digibyte-7.17.2-aarch64-linux-gnu.tar.gz instead.

$ cd $HOME
$ wget https://github.com/digibyte/digibyte/releases/download/v7.17.2/digibyte-7.17.2-x86_64-linux-gnu.tar.gz
$ tar xvzf digibyte-7.17.2-x86_64-linux-gnu.tar.gz

Create a symbolic link to make upgrading DigiByte in the future easier.

$ cd ~/digibyte-7.17.2
$ ln -s digibyte-7.17.2 digibyte

This means that binaries now are always available in ~/digibyte/bin regardless of the release number.

Add service file

For DigiByte to run as a service and to be able to start automatically upon boot, a service file needs to be installed. Execute the following as root user.

CentOS:

# cat <<EOF > /usr/lib/systemd/system/digibyted.service
[Unit]
Description=DigiByte's distributed currency daemon
After=network.target

[Service]
User=digibyte
Group=digibyte

Type=forking
PIDFile=/home/digibyte/.digibyte/digibyted.pid
ExecStart=/home/digibyte/digibyte/bin/digibyted -daemon -pid=/home/digibyte/.digibyte/digibyted.pid \
-conf=/home/digibyte/.digibyte/digibyte.conf -datadir=/home/digibyte/.digibyte -disablewallet

Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
EOF

Ubuntu:

# cat <<EOF > /etc/systemd/system/digibyted.service
[Unit]
Description=DigiByte's distributed currency daemon
After=network.target

[Service]
User=digiminer
Group=digiminer

Type=forking
PIDFile=/home/digiminer/.digibyte/digibyted.pid
ExecStart=/home/digibyte/digibyte/bin/digibyted -daemon -pid=/home/digiminer/.digibyte/digibyted.pid \
-conf=/home/digiminer/.digibyte/digibyte.conf -datadir=/home/digiminer/.digibyte -disablewallet

Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
EOF

Enable the service on boot.

$ sudo systemctl enable digibyted.service

Start the service.

$ sudo systemctl start digibyted.service


Check the log file

$ tail -f ~/.digibyte/debug.log

This should output the current actions or show any error.

The initial synchronization of the local block chain will take several hours. 

If you are behind a router, TCP port 12024 should be forwarded in order run as an open node. See Running a full node for details.