How to Set Up an Ethereum Node on Ubuntu

·

Setting up your own Ethereum node gives you direct access to the blockchain, enabling you to interact with smart contracts, validate transactions, and contribute to network decentralization. This comprehensive guide walks you through deploying a full Ethereum node on Ubuntu using Geth (Go Ethereum), from installation to synchronization and management.

Whether you're a developer, blockchain enthusiast, or someone interested in running infrastructure, this tutorial ensures clarity, reliability, and performance optimization.


Install Geth on Ubuntu

The first step in running an Ethereum node is installing Geth, one of the most widely used Ethereum clients written in Go. It allows your machine to connect to the Ethereum network, download the blockchain, and participate in consensus.

Follow these commands to install Geth via the official Ethereum PPA repository:

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

👉 Learn how blockchain nodes power decentralized applications today.

After installation, verify that Geth was installed correctly by checking its version:

geth version

You should see output similar to:

Geth Version: 1.13.0-stable
Git Commit: ...
Architecture: amd64
Protocol Versions: [66 65 64]
Network Id: 1
Go Version: go1.20.4
Operating System: linux

A successful version display confirms that Geth is ready for configuration.


Configure Geth Startup and Shutdown Scripts

To manage your node efficiently, it's best practice to create reusable startup and shutdown scripts. These simplify operations and ensure consistent execution parameters.

Determine Your Server’s Internal IP Address

Before launching Geth, identify your server's internal IP address using ifconfig or ip addr. For example:

ifconfig -a

Look for the active network interface (e.g., eno1, eth0, or ens3) and note the inet addr value — such as 173.209.49.10.

Create a Geth Startup Script

Create a script named starteth.sh to launch Geth with essential flags:

#!/bin/bash
nohup geth \
  --http \
  --http.addr "173.209.49.10" \
  --http.corsdomain="*" \
  --datadir "/data/ethereum" \
  >> geth.log 2>&1 &
Note: Replace "173.209.49.10" with your actual internal IP. The --datadir flag points to a custom directory for storing blockchain data — ideal if you're using a large external disk.

Key flags explained:

Create a Shutdown Script

To stop the node gracefully, create stopeth.sh:

#!/bin/bash
PIDS=$(ps -ef | grep geth | grep -v grep | awk '{print $2}')
if [ -n "$PIDS" ]; then
    kill -9 $PIDS
    echo "$(date '+%F %H:%M:%S') Geth process stopped."
else
    echo "$(date '+%F %H:%M:%S') Geth is not running!"
fi

This script checks for active Geth processes and terminates them cleanly.

Set Execute Permissions

Make both scripts executable:

chmod u+x starteth.sh stopeth.sh

Verify permissions:

ls -la *.sh

Output should show execution rights:

-rwxr--r-- 1 root root  95 Jul 10 11:41 starteth.sh
-rwxr--r-- 1 root root 171 Jul 11 21:49 stopeth.sh

Start Geth and Sync Blockchain Data

With scripts in place, begin syncing the Ethereum blockchain:

./starteth.sh

Monitor progress by tailing the log file:

tail -f geth.log

During sync, you’ll see entries like:

INFO [07-11|21:51:06.609] Imported new chain segment blocks=1 txs=55 mgas=7.992 elapsed=368.336ms mgasps=21.697 number=5948083 hash=14c024…a9d1bb cache=267.07mB
INFO [07-11|21:51:10.051] Imported new chain segment blocks=1 txs=43 mgas=7.987 elapsed=105.155ms mgasps=75.959 number=5948084 hash=ede212…56e3b8 cache=267.22mB

The number= field indicates the current block height being synced.

👉 Discover how real-time blockchain data powers decentralized finance innovations.

Sync Duration and Performance Tips

Full synchronization from block 0 typically takes 2–4 days, depending on:

For faster sync times:

You can also deploy your node on cloud providers like AWS, Google Cloud, or Alibaba Cloud (e.g., Hong Kong region) for better international connectivity.


Verify Synchronization Completion

Once syncing begins, you need a way to confirm when your node reaches the latest block.

Access the Geth Console

Attach to the running Geth instance:

geth attach http://localhost:8545

Then run:

eth.syncing

If syncing is still in progress, it returns an object with currentBlock, highestBlock, etc.

When synchronization finishes, it returns false.

Alternatively, check the current block number:

eth.blockNumber

Compare this number with the latest block on Etherscan to confirm alignment.

When both values match, your node is fully synchronized and operational.


Frequently Asked Questions (FAQ)

Q: What are the minimum system requirements for running a Geth node?

A: At minimum, you’ll need:

Q: Is it safe to expose my node’s RPC endpoint publicly?

A: No. Avoid setting --http.corsdomain="*" or binding RPC to public IPs in production. Use firewalls, authentication layers, or reverse proxies to secure access.

Q: Can I use this node for staking ETH?

A: Running Geth alone does not enable staking. You’ll also need to run a consensus client (like Lighthouse or Teku) and operate validator keys with at least 32 ETH.

Q: How do I back up my Ethereum node?

A: Regularly back up the --datadir folder (e.g., /data/ethereum). This contains chain data, keystore files, and network states. Store backups securely offline.

Q: What is the difference between fast sync and full sync?

A: Fast sync downloads recent state data instead of processing every historical transaction (much faster). Full sync verifies all blocks since genesis but takes significantly longer and more storage.

Q: Can I run other dApps or wallets with this node?

A: Yes! Once synced, your node can serve as a backend for MetaMask, DApp browsers, decentralized exchanges, and custom smart contract tools via JSON-RPC calls.


Core Keywords for SEO

These keywords have been naturally integrated throughout the article to enhance search visibility while maintaining readability and technical accuracy.


By following this guide, you now have a fully functional Ethereum node running on Ubuntu — giving you autonomy, privacy, and direct access to the world of decentralized applications.

👉 Explore how blockchain nodes support the future of Web3 and digital ownership.