Installing Geth
To install Geth (Go Ethereum), follow these steps:
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereumAfter installation, verify the Geth version to confirm successful setup:
geth versionExpected output example:
Geth Version: 1.8.12-stable
Git Commit: 37685930d953bcbe023f9bc65b135a8d8b8f1488
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: linuxCreating Geth Start/Stop Scripts
Step 1: Identify Your Local IP Address
Run this command to find your internal IP:
ifconfig -aStep 2: Create Startup Script (starteth.sh)
#!/bin/bash
nohup geth --rpcaddr "YOUR_LOCAL_IP" --rpc --rpccorsdomain="*" --datadir "/data/ethereum" >> geth.log 2>&1 &Step 3: Create Stop Script (stopeth.sh)
#!/bin/bash
PIDS=$(ps -ef | grep geth | grep -v grep | awk '{print $2}')
if [ "$PIDS" != "" ]; then
kill -9 $PIDS
else
echo "$(date +%F" "%H:%M:%S) Geth is NOT running!"
fiStep 4: Set Execute Permissions
chmod u+x st*.shStarting Geth and Syncing Blockchain Data
Begin synchronization with:
./starteth.shMonitor progress by viewing the log:
tail -f geth.log๐ Learn more about Ethereum node synchronization
Verifying Sync Completion
Check synchronization status via Geth console:
geth attach
> eth.blockNumberFAQ Section
Q: How long does initial synchronization take?
A: Typically 3+ days depending on server bandwidth and hardware.
Q: Why does eth.blockNumber return 0?
A: This indicates synchronization is still in progress.
Q: What's the recommended server specification?
A: Minimum 4CPU/8GB RAM with SSD storage and high-speed internet.
๐ Explore cloud server options for Ethereum nodes
Q: How to troubleshoot stalled synchronization?
A: 1) Verify sufficient disk space 2) Check network connectivity 3) Restart Geth process.
Optimization Tips
For better performance:
- Allocate at least 500GB storage
- Use
--cacheparameter to increase memory allocation - Consider
--fastsync mode for faster initial sync
Remember to always maintain proper security measures when running public nodes.