Running a Monero Node on Digital Ocean

Why Run a Node?

Nodes help the community by storing the blockchain and allowing others to access it.

Keeping the blockchain decentralized is very important to having a rigid network.

Setting up Digital Ocean settings

If you wish to sign-up for Digital Ocean using my referral code click here.

First we will go to "Settings" and then click on "Security".

We will then add an SSH key. To do this we will use SSH-keygen.

Running ssh-keygen -t rsa will generate an SSH key for us.

You will be required to create a passphrase (I recommend using a tool like LastPass or 1Pass).

Then run pbcopy < ~/.ssh/id_rsa.pub to put your key into your clipboard.

Copy and paste.

Creating the Droplet.

Select the droplets screen.

It is best to select Ubuntu 16.04 since this is what this guide used.

I then recommend selection the $5/mo droplet size.

You can select any region you wish, I chose Toronto.

Make sure your SSH key is selected if you set that up.

Creating a User

To create a user we run adduser username. We then make this user to the sudo group with usermod -aG sudo username.

We must then allow this user to connect using our public key. On our host machine run pbcopy < ~/.ssh/id_rsa.pub.

Now, back on the server run su - username to login to that user. Now, mkdir ~/.ssh and chmod 700 ~/.ssh to create the .ssh dir and allow writing.

Now copy and paste your public key to ~/.ssh/authorized_keys. Then restrict the permissions with chmod 600 ~/.ssh. We can now login with the new user.

We now disable root by changing PermitRootLogin yes to PermitRootLogin no in /etc/ssh/sshd_config, and then restart the SSH daemon with sudo service sshd restart.

Downloading Monero

Download Linux 64 bit from Github.

$ tar -vxjf monero-linux-x64-v0.10.3.1.tar.bz2
      

Install Supervisor

Supervisor is a process control system that is quite easy to interface with.


      $ sudo apt-get update
      $ sudo apt-get upgrade
      $ sudo apt-get install supervisor
      

Now make sure Supervisor is running: sudo service supervisor restart.

Putting it all together

We will now create a file for Supervisor to autostart the Monero Node Daemon.

Create /etc/supervisor/conf.d/monerod.conf using sudo /touch /etc/supervisor/conf.d/monerod.conf.


      [program:monerod]
      command=~/monero/monerod
      autostart=true
      autorestart=true
      stderr_logfile=/var/log/supervisor/monerod.err.log
      stdout_logfile=/var/log/supervisor/monerod.out.log
      

Now restart Supervisor sudo service supervisor restart.