antanst's personal home page

How to set up a Monero Node in Ubuntu 14.04

Introduction

In this guide we'll be compiling our own bitmonero daemon from the official git repository. At the time of this writing, the latest stable version was 0.8.8.6, which didn't yet use a database to store the blockchain so it's RAM requirements were way too high for small machines. This is why we're going to build and use the latest version from the official GitHub repository.

This guide assumes the system is a pristine and up to date Ubuntu 14.04 installation.

We assume that the following commands are run as root.

Install dependencies

Note: We install Boost version 1.55 as 1.54 is not recommended due to a serious bug.

apt-get install git make cmake build-essential git libssl-dev pkg-config libevent-dev libunbound-dev libminiupnpc-dev doxygen supervisor jq libboost-.*1.55.*

Create a user and build monero

adduser --disabled-password bitmonerod

Just hit enter on the questions asked until you're done. Next, fetch and build monero:

su bitmonerod
cd ~
git clone https://github.com/monero-project/bitmonero.git
cd bitmonerod
make release-static #now wait a few minutes to build
cp -Rv ~/bitmonero/build/release/bin ~/bitmonero-build
mkdir ~/.bitmonero
exit

If compilation didn't complete successfully, which might happen our case as we're using the development version of monero, check GitHub's issues in case it's a known bug.

Set up supervisor to make bitmonerod start during system boot

Edit /etc/supervisor/supervisord.conf and add the following at the end of the file:

[program:bitmonerod]
command=/home/bitmonerod/bitmonero-build/bitmonerod --p2p-bind-ip=<YOUR_IP_ADDRESS> --limit-rate-up=1024 --limit-rate-down=1024 --limit-rate=1024 --log-file=/home/bitmonerod/.bitmonero/log --data-dir=/home/bitmonerod/.bitmonero
user=bitmonerod
directory=/home/bitmonerod
priority=10
stopwaitsecs=60
stdout_logfile=/var/log/supervisor/bitmonerod-stdout.log
stderr_logfile=/var/log/supervisor/bitmonerod-stderr.log

You should replace the "1024" limit values, depending on your available bandwidth. These values correspond to kB/s, so the above example specifies a one megabyte per second bandwidth limit.

Start supervisord and monitor bitmonerod output

ufw allow 18080 #Open the monero p2p port to the outside world
service supervisor restart
tail -f /var/log/supervisord/supervisord.log

You should see a message like success: bitmonerod entered RUNNING state, process has stayed up for > than 1 seconds. Congratulations! This means that the monero daemon is up and running.

Monitoring bitmonerod

You can monitor the daemon's output by looking at it's log file:

tail -f /home/bitmonerod/.bitmonero/log

You can also get the status of the daemon via an RPC call:

curl -s -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"test","method":"get_info","params":{}}' -H "Content-Type: application/json" | jq .