Installing an Ethereum Blockchain Node using Geth

Prerequisites

Ensure that your system meets the following requirements:

  • RAM: At least 16GB
  • Storage: At least 2TB
  • Internet: A stable and fast connection

All commands in this guide are executed as the root user.


1. Install Geth

Update and Install Dependencies

Run the following commands to update your system and install essential packages:

1
2
sudo apt update && sudo apt upgrade -y
sudo apt install -y git build-essential

Install Go (Golang)

Geth requires Go, so install it using the commands below:

1
2
wget https://go.dev/dl/go1.21.7.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.7.linux-amd64.tar.gz

Configure Environment Variables

Edit your ~/.bashrc file:

1
nano ~/.bashrc

Add the following lines at the end of the file:

1
2
3
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Apply the changes:

1
source ~/.bashrc

Download and Build Geth

1
2
3
4
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum
make geth
sudo cp build/bin/geth /usr/local/bin/

2. Running Geth

Create a Data Directory and Start Geth

1
2
3
4
5
6
7
mkdir ~/ethereum
geth --datadir ~/ethereum \
--http --http.port 8080 --http.addr "0.0.0.0" \
--syncmode "snap" \
--authrpc.addr "127.0.0.1" --authrpc.port 8551 \
--authrpc.jwtsecret ~/ethereum/geth/jwtsecret \
--maxpeers 100

This will start Geth and expose the JSON-RPC API on port 8080.

(Optional) Disable IPv6

If you experience network issues, disabling IPv6 can help:

1
2
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

3. Install and Run Lighthouse (Consensus Layer)

Ethereum transitioned to Proof-of-Stake (PoS) in 2022. This means you need both:

  • Execution Layer (EL) → Geth
  • Consensus Layer (CL) → Lighthouse (or another beacon client)

Install Rust and Build Lighthouse

1
2
3
4
5
6
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup update
git clone https://github.com/sigp/lighthouse.git
cd lighthouse
make

(Troubleshooting) Install Required Dependencies

If you encounter errors while running make, install clang and other required dependencies:

1
2
3
sudo apt install -y libc6-dev build-essential clang cmake
export CC=gcc
export CFLAGS="-I/usr/include"

Run Lighthouse

1
lighthouse beacon_node --network mainnet --datadir ~/beacon --http --http-address 0.0.0.0 --http-port 5052 --execution-endpoint http://127.0.0.1:8551 --execution-jwt ~/ethereum/geth/jwtsecret --checkpoint-sync-url https://mainnet-checkpoint-sync.attestant.io

You may check more endpoints at: (https://eth-clients.github.io/checkpoint-sync-endpoints/)

⚠️ Make sure Geth is running before starting Lighthouse.


4. Testing Your Ethereum Node

Once both Geth and Lighthouse are running, you can test your node by making an RPC call:

1
2
3
curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://192.168.1.150:8080

If your node is running correctly, it will return something like:

1
{"jsonrpc":"2.0","id":1,"result":"0x0"}

(Replace 192.168.1.150 with your actual server IP.)


Final Notes

  • This tutorial sets up an Ethereum full node using Geth and Lighthouse.
  • Your node will synchronize with the Ethereum network, which can take time.
  • Ensure your system meets the hardware requirements to avoid performance issues.

Check status:

Command:

1
geth attach ~/ethereum/geth.ipc

In console:

1
eth.syncing

Example results:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
currentBlock: 8959360,
healedBytecodeBytes: 0,
healedBytecodes: 0,
healedTrienodeBytes: 0,
healedTrienodes: 0,
healingBytecode: 0,
healingTrienodes: 0,
highestBlock: 21971505,
startingBlock: 0,
syncedAccountBytes: 29609285538,
syncedAccounts: 137604971,
syncedBytecodeBytes: 5151118382,
syncedBytecodes: 794044,
syncedStorage: 609184446,
syncedStorageBytes: 135929810634,
txIndexFinishedBlocks: 0,
txIndexRemainingBlocks: 1
}
1
net.peerCount