Ethereum 2.0 Mainnet Staking Guide with Ubuntu and Teku

·

Staking on the Ethereum 2.0 mainnet marks a pivotal shift in the blockchain’s evolution—from proof-of-work to proof-of-stake. This comprehensive guide walks you through setting up a secure and functional staking node using Ubuntu 20.04, Go Ethereum (Geth), and the ConsenSys Teku client. Whether you're a developer, crypto enthusiast, or long-term investor, this tutorial empowers you to become an active validator and earn staking rewards.

⚠️ Important: You’ll need at least 32 ETH and additional gas fees to participate. Never send ETH directly to any address without understanding the process. This guide ensures your funds are safely deposited into the official Ethereum deposit contract.

Why Stake on Ethereum 2.0?

Ethereum’s transition to proof-of-stake has opened the door for users to help secure the network and earn passive income. By running a validator node, you contribute to consensus, transaction validation, and network decentralization—all while earning ETH rewards over time.

This setup uses:

👉 Start your Ethereum staking journey securely with trusted tools.


Prerequisites

Before diving in, ensure you meet these requirements:

Technical Knowledge

Hardware Requirements

To run a full node smoothly:

💡 Tip: Use a local machine instead of cloud hosting when possible. It enhances decentralization and reduces dependency on third-party providers.

Step 1: Generate Staking Keys and Deposit Data

Each validator requires 32 ETH. If you plan to run multiple validators (e.g., 2 = 64 ETH), prepare accordingly.

Download the Deposit CLI Tool

Visit the official repository:
https://github.com/ethereum/eth2.0-deposit-cli/releases
Download the version matching your OS (Windows, Mac, or Linux).

Run the CLI and Generate Keys

Extract the binary and execute it in your terminal:

Linux/Mac:

./deposit new-mnemonic --num_validators 1 --chain mainnet

Windows:

deposit.exe new-mnemonic --num_validators 1 --chain mainnet

Replace 1 with your desired number of validators.

You’ll be prompted to:

  1. Set a keystore password – Save this securely; it’s required to import keys into Teku.
  2. Back up your mnemonic phrase – This is critical for withdrawals and future key generation.
🔐 Security Note: For maximum safety, run this on an air-gapped computer (disconnected from the internet). Avoid executing it on a device currently online.

After completion, two types of files are generated:

👉 Learn how to protect your staking keys like a pro.


Step 2: Connect to Your Ubuntu Server

Use SSH to access your server:

ssh username@your_server_ip

If logging in as root, create a dedicated user with sudo privileges:

adduser yourusername
usermod -aG sudo yourusername

Optionally copy SSH keys:

rsync --archive --chown=yourusername:yourusername ~/.ssh /home/yourusername

Log out and log back in with your new user.


Step 3: Update the System

Ensure all packages are up to date:

sudo apt update && sudo apt upgrade -y
sudo apt dist-upgrade -y && sudo apt autoremove -y
sudo reboot

Step 4: Secure Your Server

Change SSH Port

Edit the SSH config:

sudo nano /etc/ssh/sshd_config

Find #Port 22, uncomment it, and change to a custom port (e.g., 6673). Then restart SSH:

sudo systemctl restart ssh

Reconnect using the new port.

Configure UFW Firewall

Install and configure the firewall:

sudo apt install ufw -y
sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow necessary ports:

sudo ufw allow 6673/tcp     # Custom SSH port
sudo ufw deny 22/tcp        # Block default SSH
sudo ufw allow 30303        # Geth P2P
sudo ufw allow 9000         # Teku P2P
sudo ufw enable
sudo ufw status numbered

Step 5: Enable Time Synchronization

Accurate timekeeping is crucial for node operation:

timedatectl
sudo timedatectl set-ntp on

Remove outdated NTP daemons if present:

sudo apt-get remove ntp -y

Step 6: Set Up Go Ethereum (Geth) Node

Install Geth

sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt update
sudo apt install geth -y

Create Service User and Directory

sudo useradd --no-create-home --shell /bin/false goeth
sudo mkdir -p /var/lib/goethereum
sudo chown -R goeth:goeth /var/lib/goethereum

Configure Systemd Service

Create the service file:

sudo nano /etc/systemd/system/geth.service

Paste the following:

[Unit]
Description=Go Ethereum Client
After=network.target

[Service]
User=goeth
Group=goeth
Type=simple
Restart=always
RestartSec=5
ExecStart=geth --http --datadir /var/lib/goethereum --cache 2048 --maxpeers 30

[Install]
WantedBy=default.target

Reload and start:

sudo systemctl daemon-reload
sudo systemctl start geth
sudo systemctl enable geth

Monitor sync progress:

sudo journalctl -fu geth.service

Check sync status:

geth attach http://127.0.0.1:8545
> eth.syncing

Return false means fully synced.


Step 7: Install Teku Client

Download the latest binary from Teku Releases:

cd ~
curl -Lo teku.tar.gz https://dl.bintray.com/consensys/pegasys-repo/teku-latest.tar.gz
tar xvf teku.tar.gz
sudo cp -a teku-* /usr/local/bin/teku
sudo apt install default-jre -y
rm -r teku* && cd ~

Step 8: Import Validator Keys

Transfer your keystore-m_*.json files to:

~/eth2deposit-cli/validator_keys/

Then move them securely:

sudo mkdir -p /var/lib/teku
sudo cp -a ~/eth2deposit-cli/validator_keys /var/lib/teku/

Delete any deposit_data*.json files in that folder.

Create password files for each keystore:

sudo nano /var/lib/teku/validator_keys/keystore-m_*.json.txt

Enter the keystore password inside.

Set strict permissions:

sudo chown -R teku:teku /var/lib/teku
sudo chmod -R 700 /var/lib/teku/validator_keys

Step 9: Configure Teku as a Service

Create the service:

sudo nano /etc/systemd/system/teku.service

Add this configuration:

[Unit]
Description=Teku Eth2 Client
Wants=network-online.target
After=network-online.target

[Service]
User=teku
Group=teku
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx2g"
ExecStart=/usr/local/bin/teku/bin/teku --data-base-path=/var/lib/teku --eth1-endpoint=http://localhost:8545 --validator-keys=/var/lib/teku/validator_keys:/var/lib/teku/validator_keys --rest-api-enabled=true --rest-api-docs-enabled=true --metrics-enabled --validators-graffiti="YourNodeName"

[Install]
WantedBy=multi-user.target

Reload and start:

sudo systemctl daemon-reload
sudo systemctl start teku
sudo systemctl enable teku

Monitor logs:

sudo journalctl -fu teku.service

Wait for full sync before depositing.


Step 10: Make Your Deposit

Go to the official launchpad:
https://launchpad.ethereum.org

  1. Select number of validators.
  2. Upload deposit_data-[timestamp].json.
  3. Connect MetaMask.
  4. Confirm transactions.

All deposits are irreversible—double-check everything.


Step 11: Monitor Your Validator

Track status at beaconcha.in using your wallet or public key. Activation may take hours to days depending on queue length.

Use tools like htop to monitor system resources.


Frequently Asked Questions (FAQ)

Q: How much ETH do I need to stake?

You need exactly 32 ETH per validator. You can run multiple validators, but each requires a separate 32 ETH deposit.

Q: Can I withdraw staked ETH?

Yes, but only after enabling withdrawals in post-Merge upgrades. Full withdrawal functionality requires both withdrawal credentials and proper key management.

Q: What happens if my node goes offline?

You’ll incur minor penalties during downtime. Frequent or prolonged outages reduce rewards and may lead to slashing in extreme cases.

Q: Is cloud hosting safe for staking?

Cloud servers work but increase centralization risk. If your provider fails, so does your node. Local hardware offers better resilience.

Q: How do I update Geth or Teku?

Regular updates are essential. Stop services, download new binaries, replace old ones, then restart. Always check logs post-update.

Q: Can I use a different client than Teku?

Yes—clients like Lighthouse, Prysm, and Nimbus are also compatible. This guide focuses on Teku for its enterprise-grade stability.


Final Notes

Congratulations—you’ve successfully set up an Ethereum 2.0 staking node! You’re now part of a decentralized network securing one of the world’s most important blockchains.

👉 Explore more ways to grow your crypto portfolio safely.

Stay engaged:

By contributing your node, you’re not just earning rewards—you’re helping shape the future of Web3.

This guide is for educational purposes only and does not constitute financial or legal advice.