Geth is the the command line interface for running a full ethereum node implemented in Go. I am going to be talking about how to install geth on ubuntu on 16.10.

Lets check out the ubuntu version....


It is good to avoid root user to install or run the softwares on linux for security reasons. So i have setup an exclusive user to carry out the installation of geth and run it.

0_1483841969379_Screenshot at 2017-01-07 19-59-05.png

Now lets prepare the dependency required to run geth. As i mentioned above geth is written in GO. So i am going to install GO run time

Download Go anywhere you like on your system , in my case i have downloaded in my home folder

curl -O

0_1483886933641_Screenshot at 2017-01-08 09-48-29.png

Unpack it to folder where you want to install it, in my case i have created a directory where i am going to install geth and Go.

tar -C /ethereum -xzf go1.7.3.linux-amd64.tar.gz

0_1483887440788_Screenshot at 2017-01-08 09-56-52.png


export GOPATH=/{your geth home directory}

export PATH=$PATH:{your geth home directory}/bin

in my case its

export GOPATH=/ethereum/go

export PATH=$PATH:/ethereum/go/bin

Building geth requires Go and C compilers to be installed:

sudo apt-get install -y build-essential golang

Now all the dependencies takes care off, lets clone the Geth software and build it.
switch to directory where you want to install geth , in my case its
0_1483888818865_Screenshot at 2017-01-08 10-19-59.png

After cloning is complete

cd go-ethereum

make geth

After build id complete you can go to "/go-ethereum/build/bin" and start geth node ..


I have put together a script that will ensure all the required variables are set before starting the node and generate the blocks in the directory you like.
open the editor of your choice and put this code, modify the paths according to your local installation.

export GOPATH=/ethereum/go
export PATH=$PATH:/ethereum/go/bin
echo "strating............."
/ethereum/go-ethereum/build/bin/geth  --rpc --rpccorsdomain "*" --datadir /ethereum/blocks 2>> /ethereum/logs/ethereum.log

Do not forget to give execute permission on file

chmod +x

I am going to run geth as background process, i have installed daemon for me to be able to run the process in background.

you can install "daemon" on ubuntu

apt-get install daemon

Now all set to start the geth node...................................................................

daemon /home/ethereum/

and you can tail the log to see the progress of start process....

0_1483892946273_Screenshot at 2017-01-08 11-28-11.png

Since we are running geth as background process, if we need to attach to geth in interactive mode , use the following command

/ethereum/go-ethereum/build/bin/geth attach ipc:/ethereum/blocks/geth.ipc

0_1483893581322_Screenshot at 2017-01-08 11-39-16.png