Guide to Run Monero Node on VPS

Snippets Mar 30, 2021

About a month ago, I host an open Monero node that is free to use for everyone as a remote RPC. Until this article was written, there were only 2 public nodes from Indonesia and both nodes were run by me.

Hopefully this article can help those of you who want to support Monero by building new public nodes, especially if only a few nodes available in your area or country.

Requirements

As a prerequisite to using this guide, I assume that you already have at least:

  • 1 Virtual Machine (off course) with public IP address.
  • 1GB of RAM (minimum)
  • 100GB of Storage
  • Ubuntu 18.04 (this guide)
I suggest that your VPS use SSD storage, because downloading and verifying the entire blockchains to the spinning hard disk can take 4 - 8 days.

Installation

We need to compile Monero from source.

Dependencies

Build ibgtest-dev binary manually because on Debian/Ubuntu libgtest-dev only includes sources and headers.

sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/

Install remaining dependencies :

sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev

Clone the repository and build

Clone recursively to pull-in needed submodule(s):

git clone --recursive https://github.com/monero-project/monero

Initialize and update:

cd monero && git submodule init && git submodule update

change to the most recent release branch (v0.17 when this article is written), and build:

git checkout release-v0.17
make
Tips: If your machine has several cores and enough memory, enable parallel build by running make -j<number of threads> or make -j$(nproc) instead of make. For this to be worthwhile, the machine should have one core and about 2GB of RAM available per thread.

The resulting executables can be found in build/Linux/release-v0.17/release/bin.

Copy compiled binary to /opt/monero/bin and change binary files permission:

mkdir -p /opt/monero
cp -rv build/Linux/release-v0.17/release/bin /opt/monero/
chmod -R 775 /opt/monero/bin

Create user and systemd for Monero daemon

Create new user who should run Monero daemon:

useradd -s /bin/sh -m monerodaemon

Create Monero systemd service file /etc/systemd/system/monero.service and add these following config:

[Unit]
Description=Monero Daemon
After=network.target

[Service]
Type=forking
GuessMainPID=no
ExecStart=/opt/monero/bin/monerod \
    --rpc-bind-ip 127.0.0.1 \
    --rpc-restricted-bind-ip [SERVER_PUBLIC_IP_ADDRESS] \
    --rpc-restricted-bind-port [RPC_RESTRICTED_PORT] \
    --confirm-external-bind \
    --public-node \
    --detach
Restart=always
User=monerodaemon

[Install]
WantedBy=multi-user.target

Change [SERVER_PUBLIC_IP_ADDRESS] above with your server public IP address and [RPC_RESTRICTED_PORT] with your desired port (recommended 18089).

Reload, start and enable daemon on startup:

systemctl daemon-reload
systemctl enable --now monero.service

Make sure monero daemon is running: systemctl status monero.service.

Firewall

Make sure your firewall for port 18080 and 18089 ([RPC_RESTRICTED_PORT] from systemd config above) is open, if not:

ufw allow 18080
ufw allow 18089

Link and Resources

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.