Cyberithub

How to Install Geth(Go Ethereum) on RHEL CentOS and Rocky Linux

Advertisements

In this article, I will take you through the steps to install Geth on RHEL CentOS and Rocky Linux. Geth is known as the main Ethereum CLI client. It provides entry into different Ethereum networks like in main, test or in private network. It is capable of running as a full node (default), archive node (retaining all historical state) or a light node (retrieving data live). It can also be used by other processes as a gateway into the Ethereum network via JSON RPC endpoints exposed on top of HTTP, Web Socket and/or IPC transports. More on GitHub.

What is Ethereum

Ethereum is a decentralized blockchain platform that establishes a peer-to-peer network that securely executes and verifies application code, called smart contracts. Smart contracts allow participants to transact with each other without a trusted central authority. Transaction records are immutable, verifiable, and securely distributed across the network, giving participants full ownership and visibility into transaction data. Transactions are sent from and received by user-created Ethereum accounts. A sender must sign transactions and spend Ether, Ethereum's native cryptocurrency, as a cost of processing transactions on the network. More about Ethereum.

Advertisements

How to Install Geth(Go Ethereum) on RHEL CentOS and Rocky Linux

How to Install Geth(Go Ethereum) on RHEL CentOS and Rocky Linux

Also Read: 20 Best LXC command examples to Manage Linux Containers

Step 1: Prerequisites

a) You should have a running RHEL/CentOS/Rocky Linux Server.

Advertisements

b) You should have sudo or root access to run privileged commands.

c) You should have yum, wget and tar utility available in your System.

Advertisements

 

Step 2: Update Your Server

In the first step you need to check for all the latest available updates using yum update command. If any of the packages needs to be upgraded then run yum upgrade command as well.

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.nhanhoa.com
* epel: mirrors.bestthaihost.com
* extras: mirrors.hostever.com
* updates: mirrors.nhanhoa.com
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:1.18.4-3.el7 will be updated
---> Package NetworkManager.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package NetworkManager-libnm.x86_64 1:1.18.4-3.el7 will be updated
---> Package NetworkManager-libnm.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package NetworkManager-team.x86_64 1:1.18.4-3.el7 will be updated
---> Package NetworkManager-team.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package NetworkManager-tui.x86_64 1:1.18.4-3.el7 will be updated
---> Package NetworkManager-tui.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package bash.x86_64 0:4.2.46-34.el7 will be updated
.......................................................

 

Step 3: Install Geth

a) Download Geth

Advertisements

You can go to Official website and download the latest package using any of the file transfer utility like wget as shown below. This will download the package in current working directory.

[root@localhost ~]# wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz
--2022-05-09 04:42:54-- https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz
Resolving gethstore.blob.core.windows.net (gethstore.blob.core.windows.net)... 20.60.40.164
Connecting to gethstore.blob.core.windows.net (gethstore.blob.core.windows.net)|20.60.40.164|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21359934 (20M) [application/octet-stream]
Saving to: ‘geth-linux-amd64-1.10.17-25c9b49f.tar.gz’

100%[===================================================================================================================>] 21,359,934 3.77MB/s in 6.6s

2022-05-09 04:43:02 (3.07 MB/s) - ‘geth-linux-amd64-1.10.17-25c9b49f.tar.gz’ saved [21359934/21359934]

b) Extract the Package

Then extract the package by using tar -xvf geth-linux-amd64-1.10.17-25c9b49f.tar.gz command as shown below. This will extract all the files under geth-linux-amd64-1.10.17-25c9b49f/ directory.

[root@localhost ~]# tar -xvf geth-linux-amd64-1.10.17-25c9b49f.tar.gz
geth-linux-amd64-1.10.17-25c9b49f/
geth-linux-amd64-1.10.17-25c9b49f/COPYING
geth-linux-amd64-1.10.17-25c9b49f/geth
tar: geth-linux-amd64-1.10.17-25c9b49f: implausibly old time stamp 1969-12-31 19:00:00

c) Copy the file

Finally copy geth binary utility into /usr/bin directory to make the utility available system wise.

[root@localhost ~]# cp geth-linux-amd64-1.10.17-25c9b49f/geth /usr/bin/

 

Step 4: Check Version

Now that geth utility is installed in the system, you can verify the installation by using geth version command as shown below.

[root@localhost ~]# geth version
Geth
Version: 1.10.17-stable
Git Commit: 25c9b49fdb74931137431c24cf28d3c65f9420d2
Git Commit Date: 20220329
Architecture: amd64
Go Version: go1.18
Operating System: linux
GOPATH=
GOROOT=go

 

Step 5: Join main network

If you want to sync quickly to the current state of the network then you can use geth console command as shown below. This command will help you attach your node to the main network post which you can create accounts, transfer funds, deploy and interact with contracts and so on.

[root@localhost ~]# geth console
INFO [05-09|08:20:45.273] Starting Geth on Ethereum mainnet...
INFO [05-09|08:20:45.273] Bumping default cache on mainnet provided=1024 updated=4096
INFO [05-09|08:20:45.275] Maximum peer count ETH=50 LES=0 total=50
INFO [05-09|08:20:45.275] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" install geth
WARN [05-09|08:20:45.292] Sanitizing cache to Go's GC limits provided=4096 updated=612
INFO [05-09|08:20:45.292] Set global gas cap cap=50,000,000
INFO [05-09|08:20:45.292] Allocated trie memory caches clean=91.00MiB dirty=153.00MiB
INFO [05-09|08:20:45.292] Allocated cache and file handles database=/root/.ethereum/geth/chaindata cache=305.00MiB handles=2048 install geth
INFO [05-09|08:20:45.351] Opened ancient database database=/root/.ethereum/geth/chaindata/ancient readonly=false
INFO [05-09|08:20:45.351] Writing default main-net genesis block
INFO [05-09|08:20:45.605] Persisted trie from memory database nodes=12356 size=1.78MiB time=61.787975ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [05-09|08:20:45.631] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 Petersburg: 7280000 Istanbul: 9069000, Muir Glacier: 9200000, Berlin: 12244000, London: 12965000, Arrow Glacier: 13773000, MergeFork: <nil>, Terminal TD: <nil>, Engine: ethash}"
................................................................

 

Step 6: Join test network

In case if you don't want to connect and interact on the main network then you also have the option to join test network where you don't have to deal with money based Ethereum contracts. You can just play around and get to know the System. This can be done by using geth --goerli console command as shown below.

[root@localhost ~]# geth --goerli console
INFO [05-09|08:25:18.011] Starting Geth on Görli testnet...
INFO [05-09|08:25:18.013] Maximum peer count ETH=50 LES=0 total=50
INFO [05-09|08:25:18.013] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
WARN [05-09|08:25:18.014] Sanitizing cache to Go's GC limits provided=1024 updated=612
INFO [05-09|08:25:18.014] Set global gas cap cap=50,000,000
INFO [05-09|08:25:18.014] Allocated trie memory caches clean=91.00MiB dirty=153.00MiB
INFO [05-09|08:25:18.014] Allocated cache and file handles database=/root/.ethereum/goerli/geth/chaindata cache=305.00MiB handles=2048 install geth
INFO [05-09|08:25:18.142] Opened ancient database database=/root/.ethereum/goerli/geth/chaindata/ancient readonly=false
INFO [05-09|08:25:18.142] Writing custom genesis block
INFO [05-09|08:25:18.148] Persisted trie from memory database nodes=361 size=51.17KiB time=1.258551ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [05-09|08:25:18.149] Initialised chain configuration config="{ChainID: 5 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: 1561651, Muir Glacier: <nil>, Berlin: 4460644, London: 5062605, Arrow Glacier: <nil>, MergeFork: <nil>, Terminal TD: <nil>, Engine: clique}"
INFO [05-09|08:25:18.150] Initialising Ethereum protocol network=5 dbversion=<nil>
.................................................................

 

Step 7: Check all the options available with geth command

If you want to check all the other options available with geth command then you to need to use geth --help command as shown below.

[root@localhost ~]# geth --help
NAME:
geth - the go-ethereum command line interface

Copyright 2013-2022 The go-ethereum Authors

USAGE:
geth [options] [command] [command options] [arguments...]

VERSION:
1.10.17-stable-25c9b49f

COMMANDS:
account Manage accounts
attach Start an interactive JavaScript environment (connect to node)
console Start an interactive JavaScript environment
db Low level database operations
dump Dump a specific block from storage
dumpconfig Show configuration values
dumpgenesis Dumps genesis block JSON configuration to stdout
export Export blockchain into file
export-preimages Export the preimage database into an RLP stream
import Import a blockchain file
import-preimages Import the preimage database from an RLP stream
init Bootstrap and initialize a new genesis block
............................................

Leave a Comment