1468003368 | IOTA node on digital ocean
 _____ ____ _______       
|_   _/ __ \__   __|/\    
  | || |  | | | |  /  \   
  | || |  | | | | / /\ \  
 _| || |__| | | |/ ____ \ 
|_____\____/  |_/_/    \_\

Setting up an IOTA node on Digital Ocean

This assumes that you are on OS X but if you are on Windows and don’t have an SSH client installed then download PuTTY and you should be able to follow along too.

  1. Sign up for a Digital Ocean account (Disclaimer: this is a referral link that will give you $10 credit and I’ll get $25 if you end up paying them $25)
  2. Log in
  3. Create a droplet
    • this link should lead you to the drop creation page and select Ubuntu on a $20 droplet in the New York datacenter, but you can select whatever region you want to.
    • at this point it seems to be the case that you need at least 2GB of RAM to run a node
    • make sure that you select Ubuntu 15.10 x64 (or higher) Droplet creation page
  4. Scroll down to give your droplet a name and then hit Create
  5. Once your droplet is setup, you should receive an email with the login details Droplet overview
  6. Open the terminal and ssh into your newly created droplet by typing in

        ssh root@INSERTYOURIPADDRESSHERE
    

    Droplet overview

  7. you’re going to be asked if you trust the remote host, which you can confirm by typing yes, after that you’re going to have to enter the password you got via email and finally change that password.

  8. update the local package index and install the software required to run a node, which can take a couple of minutes

        apt-get -y update
        apt-get -y install openjdk-8-jre
    
  9. download the latest (as of today) IOTA node

        mkdir -p /opt/iota && cd /opt/iota
        wget -O IRI.jar https://github.com/iotaledger/iri/releases/download/v1.4.1.2/iri-1.4.1.2.jar
    
  10. download my small script to add/remove neighbours

        wget -O neighbours.py https://gist.githubusercontent.com/knarz/7f07d31912b43162d019168523c57219/raw/9a79ea490dcb3f5bf430447376020f4c25cca6e7/neighbours.py
    
  11. get the iota service definition for systemd

        cd /etc/systemd/system
        wget -O iota.service https://gist.githubusercontent.com/knarz/290450abf59bad77f61dc623226e1ad5/raw/674cf5aa6e20a7958809c770b32966d135d1387f/iota.service
    
  12. get the iri.ini file

        cd /opt/iota
        wget -O iri.ini https://gist.githubusercontent.com/knarz/690c4df4071859d2345819d570b0684d/raw/0967876503ac945526881da275e4db9264793756/iri.ini
    
  13. add some neighbours

        cd /opt/iota
        python neighbours.py add udp://neighbour1:14265 udp://neighbour2:14265
    
  14. now you need to tell upstart to enable the iota service, in order to keep it running after a restart. The command can produce an error Failed to execute operation: Invalid argument which can be ignore

        systemctl daemon-reload && systemctl enable iota
        systemctl start iota
    
  15. if you run the following command and get back a number, then the node should be up

        pgrep java
    

Maintaining the node

Updating the node to a newer version:

        cd /opt/iota
        wget -O IRI.jar https://URLTOTHENEWJAR
        systemctl restart iota

adding another neighbour

        cd /opt/iota
        python neighbours.py add udp://neighbour3:14265
        systemctl daemon-reload && systemctl restart iota

delete a neighbour

        cd /opt/iota
        python neighbours.py delete udp://neighbour2:14265
        systemctl daemon-reload && systemctl restart iota

To see the logs of the node process:

        journalctl -u iota -f