Running a full open node on a Linux server

From Beyondcoin Wiki
Jump to navigation Jump to search

These instructions will explain how to run a full open Beyondcoin 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 Beyondcoin 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[edit]

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[edit]

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[edit]

If a non-root user does not already exist, create a user name beyondcoin, running the following commands as root user.

CentOS:[edit]

useradd -G wheel beyondcoin -m -s /bin/bash

Ubuntu:[edit]

useradd -G sudo beyondcoin -m -s /bin/bash

Set the password for the new user.

passwd beyondcoin

Logon as user beyondcoin.

su - beyondcoin

 

Create a Beyondcoin configuation file[edit]

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

mkdir -vp ~/.beyondcoin

We will now create a basic Beyondcoin 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 > ~/.beyondcoin/beyondcoin.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 Beyondcoin software[edit]

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

cd ~/
wget -c https://github.com/beyondcoin-project/beyondcoin/releases/download/v0.16.3/beyondcoin-0.16.3-x86_64-linux-gnu.tar.gz -O - | tar xz

We can now launch the Beyondcoin 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.

~/beyondcoin-0.16.3/bin/beyondcoind

 

Add service file[edit]

For Beyondcoin 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:[edit]

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

[Service]
User=beyondcoin
Group=beyondcoin

Type=forking
PIDFile=/home/beyondcoin/.beyondcoin/beyondcoind.pid
ExecStart=/home/beyondcoin/beyondcoin-0.16.3/bin/beyondcoind-daemon -pid=/home/beyondcoin/.beyondcoin/beyondcoind.pid \
-conf=/home/beyondcoin/.beyondcoin/beyondcoin.conf -datadir=/home/beyondcoin/.beyondcoin -disablewallet

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

[Install]
WantedBy=multi-user.target
EOF

Ubuntu:[edit]

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

[Service]
User=beyondcoin
Group=beyondcoin

Type=forking
PIDFile=/home/beyondcoin/.beyondcoin/beyondcoind.pid
ExecStart=/home/beyondcoin/beyondcoin-0.16.3/bin/beyondcoind -daemon -pid=/home/beyondcoin/.beyondcoin/beyondcoind.pid \
-conf=/home/beyondcoin/.beyondcoin/beyondcoin.conf -datadir=/home/beyondcoin/.beyondcoin -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 beyondcoind.service

Start the service.

sudo systemctl start beyondcoind.service


Check the log file
[edit]

tail -f ~/.beyondcoin/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 10333 should be forwarded in order run as an open node. See Running a full node for details.

 

Upgrade tip[edit]

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

cd ~/
ln -s beyondcoin-0.16.3 beyondcoin

In the service file, replace all occurrences of /home/beyondcoin/beyondcoin-0.16.3/ with /home/beyondcoin/beyondcoin/

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