Difference between revisions of "Running a full open node on a Linux server"

From DigiByte Wiki
Jump to navigation Jump to search
(Tidied up)
 
(8 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
Basic Linux system administration knowledge is assumed and you may need to install additional packages if an error is encountered.
 
Basic Linux system administration knowledge is assumed and you may need to install additional packages if an error is encountered.
  
 
 
  
== System Requirements ==
+
===Note on Release===
  
 +
It is possible that by now the latest release of DigiByte Core is more recent than 7.17.3 which is mentioned throughout this article. If the latest release is more recent than 7.17.3, then update the release numbers below to match the current version.
 +
 +
The latest release can be found here: https://github.com/DigiByte-Core/digibyte/releases
 +
 +
==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.
 
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.
 
The server needs at least 4GB of RAM and 40 GB disk space to be able to operate smoothly.
  
 
 
  
== Swap space ==
 
  
 +
==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.
 
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.
 
<pre>free -h</pre>
 
<pre>free -h</pre>
  
&nbsp;
+
 
  
 
If you do not have 8GB+ of swap space, you can run the following commands as '''root''' user to create a swapfile.
 
If you do not have 8GB+ of swap space, you can run the following commands as '''root''' user to create a swapfile.
Line 36: Line 39:
 
</pre>
 
</pre>
  
&nbsp;
 
  
== Create user ==
 
  
If a non-root user does not already exist, create a user name digibyte, running the following commands&nbsp;as '''root''' user.
+
==Create user==
 +
If a non-root user does not already exist, create a user name digibyte, running the following commandsas '''root''' user.
  
=== CentOS: ===
+
===CentOS:===
 
<pre>useradd -G wheel digibyte -m -s /bin/bash</pre>
 
<pre>useradd -G wheel digibyte -m -s /bin/bash</pre>
  
=== Ubuntu: ===
+
===Ubuntu:===
 
<pre>useradd -G sudo digibyte -m -s /bin/bash</pre>
 
<pre>useradd -G sudo digibyte -m -s /bin/bash</pre>
  
Line 54: Line 56:
 
<pre>su - digibyte</pre>
 
<pre>su - digibyte</pre>
  
&nbsp;
 
  
== Create a DigiByte configuation file ==
 
  
 +
==Create a DigiByte configuation file==
 
First of all we need to create the DigiByte directory for us to put the .conf in:
 
First of all we need to create the DigiByte directory for us to put the .conf in:
 
<pre>mkdir -vp ~/.digibyte</pre>
 
<pre>mkdir -vp ~/.digibyte</pre>
Line 70: Line 71:
 
If you are on a bandwidth-limited data connection, you may want to consider decreating the maxconnections, or alternatively look to increase your data plan to a flat-rate unlimited plan.
 
If you are on a bandwidth-limited data connection, you may want to consider decreating the maxconnections, or alternatively look to increase your data plan to a flat-rate unlimited plan.
  
&nbsp;
 
  
== 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&nbsp;''digibyte-7.17.2-aarch64-linux-gnu.tar.gz'' instead.
+
==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.3-aarch64-linux-gnu.tar.gz'' instead.
 
<pre>cd ~/
 
<pre>cd ~/
wget -c https://github.com/digibyte/digibyte/releases/download/v7.17.2/digibyte-7.17.2-x86_64-linux-gnu.tar.gz -O - | tar xz
+
wget -c https://github.com/digibyte-core/digibyte/releases/download/v7.17.3/digibyte-7.17.3-x86_64-linux-gnu.tar.gz -O - | tar xz
 
</pre>
 
</pre>
  
We can now launch the DigiByte daemon (Core Wallet), and it will begin to run as a background process:
+
We can now launch the DigiByte daemon (Core Wallet), and it will begin to run as a background process. If you are planning to run as a service (recommended), this step can be skipped and just read on.
<pre>~/digibyte-7.17.2/bin/digibyted
+
<pre>~/digibyte-7.17.3/bin/digibyted
 
</pre>
 
</pre>
  
&nbsp;
 
  
== Add service file ==
 
  
 +
==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.
 
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: ===
+
===CentOS:===
<pre># cat <<EOF > /usr/lib/systemd/system/digibyted.service
+
<pre>cat <<EOF > /usr/lib/systemd/system/digibyted.service
 
[Unit]
 
[Unit]
 
Description=DigiByte's distributed currency daemon
 
Description=DigiByte's distributed currency daemon
Line 101: Line 100:
 
Type=forking
 
Type=forking
 
PIDFile=/home/digibyte/.digibyte/digibyted.pid
 
PIDFile=/home/digibyte/.digibyte/digibyted.pid
ExecStart=/home/digibyte/digibyte-7.17.2/bin/digibyted -daemon -pid=/home/digibyte/.digibyte/digibyted.pid \
+
ExecStart=/home/digibyte/digibyte-7.17.3/bin/digibyted -daemon -pid=/home/digibyte/.digibyte/digibyted.pid \
 
-conf=/home/digibyte/.digibyte/digibyte.conf -datadir=/home/digibyte/.digibyte -disablewallet
 
-conf=/home/digibyte/.digibyte/digibyte.conf -datadir=/home/digibyte/.digibyte -disablewallet
  
Line 115: Line 114:
 
EOF</pre>
 
EOF</pre>
  
=== Ubuntu: ===
+
===Ubuntu:===
<pre># cat <<EOF > /etc/systemd/system/digibyted.service
+
<pre>cat <<EOF > /etc/systemd/system/digibyted.service
 
[Unit]
 
[Unit]
 
Description=DigiByte's distributed currency daemon
 
Description=DigiByte's distributed currency daemon
Line 122: Line 121:
  
 
[Service]
 
[Service]
User=digiminer
+
User=digibyte
Group=digiminer
+
Group=digibyte
  
 
Type=forking
 
Type=forking
PIDFile=/home/digiminer/.digibyte/digibyted.pid
+
PIDFile=/home/digibyte/.digibyte/digibyted.pid
ExecStart=/home/digibyte/digibyte-7.17.2/bin/digibyted -daemon -pid=/home/digiminer/.digibyte/digibyted.pid \
+
ExecStart=/home/digibyte/digibyte-7.17.3/bin/digibyted -daemon -pid=/home/digibyte/.digibyte/digibyted.pid \
-conf=/home/digiminer/.digibyte/digibyte.conf -datadir=/home/digiminer/.digibyte -disablewallet
+
-conf=/home/digibyte/.digibyte/digibyte.conf -datadir=/home/digibyte/.digibyte -disablewallet
  
 
Restart=always
 
Restart=always
Line 142: Line 141:
  
 
Enable the service on boot.
 
Enable the service on boot.
<pre>$ sudo systemctl enable digibyted.service</pre>
+
<pre>sudo systemctl enable digibyted.service</pre>
  
 
Start the service.
 
Start the service.
<pre>$ sudo systemctl start digibyted.service</pre>
+
<pre>sudo systemctl start digibyted.service</pre>
  
== <br/> Check the log file ==
+
==<br /> Check the log file==
<pre>$ tail -f ~/.digibyte/debug.log</pre>
+
<pre>tail -f ~/.digibyte/debug.log</pre>
  
 
This should output the current actions or show any error. The initial synchronization of the local block chain can take several hours, but on a decent server will take <2hrs.
 
This should output the current actions or show any error. The initial synchronization of the local block chain can take several hours, but on a decent server will take <2hrs.
  
If you are behind a router, TCP port 12024 should be forwarded in order run as an open node. See '''''[[Running_a_full_node|Running a full node]]'''''&nbsp;for details.
+
If you are behind a router, TCP port 12024 should be forwarded in order run as an open node. See '''''[[Running_a_full_node|Running a full node]]'''''for details.
 +
 
 +
 
 +
 
 +
==Upgrade tip==
 +
In order to make upgrading to a future DigiByte release a simple task, a symbolic link can be created pointing to the current DigiByte directory.
 +
<pre>cd ~/
 +
ln -s digibyte-7.17.3 digibyte</pre>
  
&nbsp;
+
In the service file, replace all occurrences of ''/home/digibyte/digibyte-7.17.3/ ''with ''/home/digibyte/digibyte/''
  
&nbsp;
+
When it is time to upgrade, simply stop the digibyted.service, download and untar the new release, delete and re-create the symbolic link pointing to the new DigiByte directory and start the digibyted.service.

Latest revision as of 04:26, 7 August 2021

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.


Note on Release

It is possible that by now the latest release of DigiByte Core is more recent than 7.17.3 which is mentioned throughout this article. If the latest release is more recent than 7.17.3, then update the release numbers below to match the current version.

The latest release can be found here: https://github.com/DigiByte-Core/digibyte/releases

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 -h


If you do not have 8GB+ of swap space, you can run the following commands as root user to create a swapfile.

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

Then verify if the swap has been added.

free -h

To make this swap permanent after every boot, we will add the required information to the fstab file:

echo "/swap swap swap defaults 0 0" >> /etc/fstab


Create user

If a non-root user does not already exist, create a user name digibyte, running the following commandsas 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

First of all we need to create the DigiByte directory for us to put the .conf in:

mkdir -vp ~/.digibyte

We will now create a basic DigiByte configuration file. As we are running on a server, there is no need for the wallet functionality and as such we will just relay the blockchain:

cat <<EOF > ~/.digibyte/digibyte.conf
daemon=1
maxconnections=300
disablewallet=1
EOF

If you are on a bandwidth-limited data connection, you may want to consider decreating the maxconnections, or alternatively look to increase your data plan to a flat-rate unlimited plan.


Install DigiByte software

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

cd ~/
wget -c https://github.com/digibyte-core/digibyte/releases/download/v7.17.3/digibyte-7.17.3-x86_64-linux-gnu.tar.gz -O - | tar xz

We can now launch the DigiByte daemon (Core Wallet), and it will begin to run as a background process. If you are planning to run as a service (recommended), this step can be skipped and just read on.

~/digibyte-7.17.3/bin/digibyted


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-7.17.3/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=digibyte
Group=digibyte

Type=forking
PIDFile=/home/digibyte/.digibyte/digibyted.pid
ExecStart=/home/digibyte/digibyte-7.17.3/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

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 can take several hours, but on a decent server will take <2hrs.

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


Upgrade tip

In order to make upgrading to a future DigiByte release a simple task, a symbolic link can be created pointing to the current DigiByte directory.

cd ~/
ln -s digibyte-7.17.3 digibyte

In the service file, replace all occurrences of /home/digibyte/digibyte-7.17.3/ with /home/digibyte/digibyte/

When it is time to upgrade, simply stop the digibyted.service, download and untar the new release, delete and re-create the symbolic link pointing to the new DigiByte directory and start the digibyted.service.