How to Run a Nexa Node on a VPS?

How to Run a Nexa Node on a VPS?

Running a Nexa node on a VPS is a straightforward process. Follow these steps to get your node up and running quickly:

  1. Get a VPS

Choose a VPS provider like DigitalOcean, AWS, or Linode. Set up your VPS and get your IP address.

  • Resource Requirements: Make sure your VPS has enough power. The storage will grow as the blockchain gets bigger.
  • Operating System: Use a Unix-like OS such as Ubuntu, Debian, or CentOS. These are reliable and commonly used for such setups.
  1. Connect to Your VPS

SSH Key Authentication: For better security, use SSH key authentication instead of passwords. Generate an SSH key pair with ssh-keygen and add the public key to your VPS.

Use SSH to connect to your VPS:

ssh username@your_vps_ip

  1. Update the System

Regular Updates: Keep your system updated to get the latest security patches and improvements. You can even set up automatic updates for critical patches.

Ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

  1. Install Dependencies

Right Versions: Make sure to install the correct versions of dependencies. Some software needs specific versions to work correctly.

Install the necessary tools and libraries:

sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libssl-dev libdb-dev libdb+±dev -y

  1. Install Nexa Node

Download the Nexa node binaries:

wget https://bitcoinunlimited.info/nexa/1.4.0.1/nexa-1.4.0.1-linux64.tar.gz
tar -xzvf nexa-1.4.0.1-linux64.tar.gz
sudo mv bin/* /usr/local/bin/

Or compile from source:

git clone https://gitlab.com/nexa/nexa.git
cd nexa
./autogen.sh
./configure
make
sudo make install

  1. Configure the Node
  • Configuration Options: Besides the basic setup, you might need to customize parameters like maxconnections (for network connections) and rpcport (for remote procedure calls). Keep your RPC credentials strong and secure.
  • RPC Security: Bind the RPC interface to localhost unless you need remote access. If you do, make sure it’s well-secured.

Create a configuration file:

mkdir -p ~/.nexa
nano ~/.nexa/nexa.conf

Add this configuration:

rpcuser=yourusername
rpcpassword=yourpassword
rpcallowip=127.0.0.1
server=1
daemon=1

  1. Start the Node
  • Initial Sync: The first time you start the node, it will sync with the blockchain network, which can take a while.
  • Log Management: Regularly check the log files in ~/.nexa/debug.log for issues. Set up log rotation to prevent logs from growing too large.

Start your node:

nexad

Check if it’s running:

./nexa-cli getpeerinfo | grep inbound

On gui:

getpeerinfo

  1. Set Up Process Management

Systemd Benefits: Using systemd ensures your node restarts automatically if it crashes and starts at boot time. You can customize the systemd service file to include specific parameters or environment variables.

Use systemd to keep your node running:

sudo nano /etc/systemd/system/nexad.service

Add this content:

[Unit]
Description=Nexa Node
After=network.target

[Service]
ExecStart=/usr/local/bin/nexad
User=yourusername
Group=yourusername
Type=forking
PIDFile=/home/yourusername/.nexa/nexad.pid
Restart=always
PrivateTmp=true
[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable nexad
sudo systemctl start nexad
sudo systemctl status nexad

  1. Open Firewall Port
  • Securing Ports: Only open the necessary ports. For example, port 7228 for network connections and your chosen RPC port if needed. Close other unnecessary ports to reduce security risks.
  • Firewall: VPS should have no router firewall.

Allow the Nexa network port through your firewall:

sudo ufw allow 7228

If you are running Rostrum, also allow its port:

sudo ufw allow 20001

  1. Monitor Your Node
  • Regular Checks: Keep an eye on your node with commands like ./nexa-cli getpeerinfo | grep inbound to monitor its status, including block height and peer connections, gui command is only getpeerinfo, then can check the entries for the inbound field.
  • Do Not Store Coins: If you are setting up an open node like this on a VPS, do not use that node to store your coins.

Keep an eye on your node:

./nexa-cli getpeerinfo | grep inbound

This guide should help you get your Nexa node up and running smoothly on a VPS. Thank you for your support!

2 Likes