Geth Node via Ubuntu: Quick Start

Matt Swezey
Pactum
Published in
3 min readJan 30, 2018

--

The following is a quick & dirty way to get a node up and running. This example will list instructions for a testnet node. This running instance will run as an Ubuntu service! Meaning if you’re server restarts for whatever reason geth will restart with it! 😎

Disclaimer: I am a happy Digital Ocean customer, but was not paid to advertise for them. 😜

Things needed in this guide:

Ubuntu Server via Digital Ocean (Referral Link: https://m.do.co/c/2e7929d058d5)

PuTTY

Keyboard & Internet Connection

Geth Command Line Options

Server: I’d recommend starting off with their flexible 2GB, 2 vCPU, 60 GB $15 droplet. That’s a sweet spot.

You got your server, you connected via PuTTY. Great!
(Hopefully you’re using ssh keys and not passwords… You’re not.. Go here and fix that.)🤔

Let’s secure the server with UFW. Follow this guide.

Open these ports listed here.

Okay so at this point you should have a server that’s secured via UFW. Awesome!

Now to install geth.

Run these commands:

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
geth -h

You should see Version 1.7.3 (at the date of this writing 1.30.2018, you may need to scroll up)

Okay, assuming you’re logged in as root (waiting for people to yell at me…) let’s create the geth.service file!

Run this command under /root (default home dir)

nano geth.service

Copy and Paste: (used pastebin because Medium was not playing nice with the returns)

https://pastebin.com/Q34A34iX

Ctrl+X, Y, Enter

Run these commands:

cp ./geth.service /etc/systemd/system/geth.service
systemctl daemon-reload
systemctl enable geth.service

Now before we do the last systemctl command, we need to configure our node! Notice: config.toml

You should still be in your root home folder (/root). Run this command below:

geth --testnet --syncmode "fast" --cache=512 --rpc --ws --shh dumpconfig > config.tomlEdit: (Thanks to Jelle van Wieringen!)`--syncmode "fast"` replaced '--fast'

geth just generated the config file for yah! BooYAH! Reference the Geth Command Line Options link at the beginning to read what those command line arguments actual do if you’re interested.

Let’s do a quick check point.

Server, check. UFW, check. Geth, check. Config file, check. Service, … ah! Let’s run it!

systemctl start geth

Okay.. hopefully you got no errors. This is good. Let’s attach geth console to our newly running node! Note: running mainnet you could just do

geth attach

But since we are on the testnet (ropsten) we have to do it this way

geth attach ipc:/root/.ethereum/testnet/geth.ipc

Run some commands!

personal.newAccount("PASSWORD GOES HERE!") // creates a new walleteth.syncing

Alright, you now have a near complete dev ready testnet node!

Get to hacking! And don’t devops199 me. 😉

--

--