Το Geth (Go Ethereum) είναι η επίσημη υλοποίηση του Ethereum protocol στη γλώσσα Go. Είναι το πιο χρησιμοποιημένο client για την εκτέλεση κόμβων (nodes) στο Ethereum mainnet, testnets και private networks. Αυτός ο οδηγός καλύπτει την εγκατάσταση σε διανομές της οικογένειας RHEL (RHEL 8/9, CentOS 7/8/Stream, Rocky Linux 8/9, AlmaLinux).
Το Geth χτίζεται με Go. Εγκαταστήστε την τελευταία σταθερή έκδοση:
# Για RHEL 8/9, Rocky, AlmaLinux
sudo dnf install -y golang
# Για CentOS 7
sudo yum install -y golang
# Επαλήθευση
go version
# Π.χ. go version go1.21.5 linux/amd64
Σημείωση: Οι εκδόσεις στα αποθετήρια μπορεί να είναι παλιότερες. Για την τελευταία Go, κατεβάστε από go.dev και εγκαταστήστε χειροκίνητα.
Προσθέστε στο ~/.bashrc (ή ~/.bash_profile):
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export GO111MODULE=on
EOF
source ~/.bashrc
Η σύγχρονη μέθοδος (Go 1.17+):
go install github.com/ethereum/go-ethereum/cmd/geth@latest
Αυτό κάνει clone, build και εγκαθιστά το binary στο $GOPATH/bin/geth (συνήθως ~/go/bin/geth).
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum
git checkout v1.13.14 # ή το tag που θέλετε
make geth
sudo cp build/bin/geth /usr/local/bin/
geth version
# Π.χ. Geth/v1.13.14-stable/linux-amd64/go1.21.5
mkdir -p ~/ethereum/mainnet
# Ή για testnet (Sepolia)
mkdir -p ~/ethereum/sepolia
Για mainnet/testnet δεν χρειάζεται genesis file - το Geth το κατεβάζει αυτόματα. Για private network:
cat > genesis.json << 'EOF'
{
"config": {
"chainId": 1337,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"mergeNetsplitBlock": 0,
"shanghaiTime": 0
},
"difficulty": "1",
"gasLimit": "30000000",
"alloc": {}
}
EOF
geth init --datadir ~/ethereum/private genesis.json
geth --datadir ~/ethereum/mainnet \
--http --http.addr 127.0.0.1 --http.port 8545 \
--http.api eth,net,web3,txpool \
--ws --ws.addr 127.0.0.1 --ws.port 8546 \
--ws.api eth,net,web3,txpool \
--syncmode full
geth --datadir ~/ethereum/mainnet \
--http --http.api eth,net,web3,txpool \
--ws --ws.api eth,net,web3,txpool \
--syncmode snap
geth --datadir ~/ethereum/mainnet --syncmode light
geth --datadir ~/ethereum/sepolia --sepolia \
--http --http.api eth,net,web3
Δημιουργήστε /etc/systemd/system/geth.service:
[Unit]
Description=Ethereum Go Client
After=network.target
Wants=network.target
[Service]
Type=simple
User=ethereum
Group=ethereum
ExecStart=/home/ethereum/go/bin/geth \
--datadir /home/ethereum/ethereum/mainnet \
--http --http.addr 127.0.0.1 --http.port 8545 \
--http.api eth,net,web3,txpool \
--ws --ws.addr 127.0.0.1 --ws.port 8546 \
--ws.api eth,net,web3,txpool \
--syncmode snap \
--cache 4096 \
--maxpeers 50
Restart=on-failure
RestartSec=10
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Και ενεργοποιήστε:
sudo useradd -r -s /bin/false -d /home/ethereum ethereum
sudo mkdir -p /home/ethereum/ethereum/mainnet
sudo chown -R ethereum:ethereum /home/ethereum
sudo systemctl daemon-reload
sudo systemctl enable --now geth
sudo journalctl -u geth -f # logs
| Παράμετρος | Περιγραφή | Προτεινόμενη τιμή |
|---|---|---|
--cache | Μνήμη cache για state (MB) | 4096 (4GB) ή 1/4 RAM |
--maxpeers | Μέγιστοι peers | 50-100 |
--syncmode | full, snap, light | snap (default) |
--http.api | API modules για RPC | eth,net,web3,txpool,debug |
--cache ή προσθέστε swap--syncmode snapgeth dumpedb για διάγνωσηss -tlnp | grep :8545--metrics --metrics.addr 0.0.0.0 --metrics.port 6060)keystore/ φακέλου για λογαριασμούςΠνευματικά δικαιώματα © Γνώση Υπολογιστών Όλα τα δικαιώματα διατηρούνται.