centos 系統 以太坊客戶端 geth 安裝記錄


<本實驗是在 騰訊雲服務器 centos 環境 上進行的>

1. 配置 GO 語言環境

   參考 菜鳥教程 go

2. 下載 編譯 go-ethereum

  git clone https://github.com/ethereum/go-ethereum

  之后進入 go-ethereum 目錄下,執行

  make geth

[root@VM_0_15_centos go-ethereum]# make geth
env GO111MODULE=on go run build/ci.go install ./cmd/geth
>>> /usr/local/go/bin/go install -ldflags -X main.gitCommit=8045504abf64a865be4b1dbc780b796a9f5d11cc -X main.gitDate=20200211 -v ./cmd/geth
github.com/ethereum/go-ethereum/internal/web3ext
github.com/peterh/liner
github.com/ethereum/go-ethereum/console
github.com/naoina/go-stringutil
github.com/naoina/toml/ast
github.com/naoina/toml
github.com/ethereum/go-ethereum/cmd/geth
Done building.
Run "./build/bin/geth" to launch geth.

  此時,容易出現 time out 錯誤。就是需要的包什么的具體也不太清楚,反正就是有東西被牆了。解決辦法就是在自己的電腦上為服務器做代理(參考務器代理),服務器通過自己的電腦網絡進行上網。自己的電腦實現了可以google,這時服務器通過自己電腦的代理,再次執行 make geth 就不會出現 time out 的問題了。

 

3. 配置環境變量

  第二步執行后,出現 Run "./build/bin/geth" to launch geth. 就說明成功了,但是 geth version 的時候會出錯,提示沒有此命令。 ./build/bin/geth 表示當前目錄即相對路徑<坑了我一天>

[root@VM_0_15_centos go-ethereum]# geth version
-bash: geth: command not found

  我們需要配置環境變量:

  export PATH=$PATH:/root/go-ethereum/build/bin

 

4. 安裝成功

  geth version  查看 geth 安裝版本信息

[root@VM_0_15_centos ~]# geth version
Geth
Version: 1.9.11-unstable
Git Commit: 5f2002bbcc1ad21818d9b08badea84acac6d0481
Git Commit Date: 20200212
Architecture: amd64
Protocol Versions: [64 63]
Go Version: go1.13.7
Operating System: linux
GOPATH=/root/go
GOROOT=/usr/local/go

 

5. tips

  有時候退出控制終端后再次進入,geth version 的時候會找不到 geth 命令(go一樣)。編輯 ~/.bashrc 

  [root@VM_0_15_centos ~]# vi ~/.bashrc  輸入以下內容(根據自己的路徑)

#go env
export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin

# geth env
export PATH=$PATH:/root/go-ethereum/build/bin

  [root@VM_0_15_centos ~]# source ~/.bashrc

 

這樣就完成了 geth 客戶端的安裝! 

參考 :

以太坊私有鏈搭建指南

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM