Quick & dirty full STRONG node setup

Ok, here’s my own secret sauce, all the commands I use to setup a node in about 10-20 minutes. All the domain stuff i’ll leave out here, but just remember that you a domain to put your json (or subdomains for node 2+) and a-records pointing at your VPS IP’s.

All commands are separate command’s that need to be copied and pasted line by line. There are a few content bits for files that you can copy & paste full in one go, I’ve marked those. And yes you will be prompted from time to time for a (Y)es or something similar, just read and fill out what is required.

Get yourself an Ubuntu 18.04 VPS from your favorite VPS provider with a minimum of 500 GB SSD storage. Start putty and connect with the information provided by your VPS provider.

Remember, pasting in putty is done with Right-Click of the mouse, copying you do by selecting the text with your mouse (nothing else, just selecting).

Ok, here we go:

  1. Update the system:
apt-get update
apt-get upgrade
apt update
apt upgrade
  1. Add your user (replace username with one of your choosing):
useradd -c "username" -d /home/username -m -s /bin/bash username
echo "%username ALL=(ALL:ALL) ALL" > /etc/sudoers.d/username
chmod 440 /etc/sudoers.d/username
passwd username
reboot

If you can logon succesfully with your own user do this:

sudo passwd --lock root
  1. Configure firewall:
sudo apt-get install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 30303/tcp
sudo ufw enable
  1. Install GETH:
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
  1. Configure GETH as a service (replace nodename with your own):
geth --cache=8096 --maxpeers=100 --http --http.addr 0.0.0.0 --http.vhosts "*" --ws --ws.addr 0.0.0.0 --ws.origins="*" --ethstats nodename:STRONG4EVER@strongstats.mortysnode.nl:3000 --nousb dumpconfig > config.toml
nano startgeth.sh

copy the following into the text editor you just opened:

geth --config config.toml 2> geth.log

Save and exit out of the editor with Ctrl-X and then Y to confirm saving.

sudo nano /lib/systemd/system/geth.service

copy the following into the text editor you just opened and replace username with your username:

[Unit]
Description=Ethereum go client
[Service]
User=username
Type=simple
WorkingDirectory=/home/username
ExecStart=/bin/bash /home/username/startgeth.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target

Save and exit out of the editor with Ctrl-X and then Y to confirm saving.

sudo systemctl enable geth
sudo systemctl start geth

Geth should be running now, let’s make sure:

tail -F geth.log

This should give you a nice running list of syncing blocks. Get back to the cmd prompt with Ctrl-c.

  1. Install NGINX:
sudo apt install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo nano /etc/nginx/conf.d/geth.conf

copy the following into the text editor you just opened and replace yournodehostname with the A-Record of your node:

server {
  listen 80;
  listen [::]:80;
  server_name yournodehostname;

  location ^~ /ws {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://127.0.0.1:8546/;
  }

  location ^~ /rpc {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://127.0.0.1:8545/;
  }
}

Save and exit out of the editor with Ctrl-X and then Y to confirm saving.

sudo rm /etc/nginx/sites-enabled/default
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install python3-certbot-nginx
sudo ufw allow 'Nginx Full'

When created a certificate for your node the A-record needs to be pointing to the IP of your VPS, otherwise the next step will fail (fill in a valid e-mail when prompted and replace yournodehostname with the A-Record of your node) :

sudo certbot --nginx -d yournodehostname

When prompted select 2 to redirect all traffic to HTTPS.

sudo nginx -s reload

And that’s it, you’re done, GETH is installed as a service and should be syncing nicely in the background, your endpoints are secured and certified and you’ve been added to StrongStats, now all you have to do is create the JSON file for your application and wait for the sync to finish.

For that JSON file your endpoints are:

"rpc_endpoint": "https://yournodehostname/rpc",
"ws_endpoint": "wss://yournodehostname/ws"

Leave a comment