geth Ubuntu 16.04 安装 及相关问题解决

geth Ubuntu 16.04 安装

采用源码安装:GitHub上的说明如下

GitHub 官方给出的 Ubuntu 系统安装geth

同时需要提前安装好go
安装go的参考博客

go安装仅仅在用户的环境变量中配置了,即~/.bashrc文件中

本次使用的gitclone 方式配置了 /etc/hosts文件,大大提高了下载速度,不然下载go-ethereum文件夹非常慢,首先去ip查询网址IPAddress查询gitclone.com ip地址,然后配置到 /etc/hosts文件末尾:

# 199.232.69.194 github.global-ssl.fastly.net 
# 140.82.114.3 github.com
# 上面俩地址配置,博主发现并没有什么用,下面的地址配置起了作用,配置完之后,
# 网速由20 kb/s 提升到 1~2 Mb/s
47.96.130.35 gitclone.com

然后同样 控制台输入source /etc/hosts 使文件配置生效。
这里要注意 go-ethereum 的下载目录 目录就是当前执行了gitclone下载命令的目录。
geth的安装教程参考了这篇博客:以太坊开发实战:geth客户端安装 的方法三。

最后在 输入命令 make geth后报错出现 error 1 ,连接拒绝错误

env GO111MODULE=on go run build/ci.go install ./cmd/geth
go: github.com/Azure/azure-pipeline-go@v0.2.2: Get "https://proxy.golang.org/github.com/%21azure/azure-pipeline-go/@v/v0.2.2.mod": dial tcp 172.217.160.81:443: connect: connection refused
Makefile:16: recipe for target 'geth' failed
make: *** [geth] Error 1

输入这一句 go env -w GOPROXY=https://goproxy.cn 就好了

总的来说主要就是三步:

  1. gitclone 下载go-ethereum git clone https://github.com/ethereum/go-ethereum
  2. 构建 geth , cd go-ethereum 进入到go-ethereum 的下载文件夹中,make geth
  3. 输入 ./build/bin/geth version 查看geth版本信息。

使用使用默认的版本安装的geth,此次安装的版本号如下:

mao@ubuntu:~/Downloads/go-ethereum$ geth version
Geth
Version: 1.9.26-unstable
Git Commit: 00d10e610f9fef56b5ee9c27f7fe7c842eba2e9b
Git Commit Date: 20201213
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.15.6
Operating System: linux
GOPATH=/home/mao/work
GOROOT=/usr/local/go

网上教学视频使用的也是稳定版的,所以使用命令修改成稳定版:

# 查看所有可用版本
mao@ubuntu:~/Downloads/go-ethereum$ git tag

# 修改版本(??并不懂具体含义,似乎是修改了geth版本???)
mao@ubuntu:~/Downloads/go-ethereum$ git checkout v1.9.3
之前的 HEAD 位置是 e76047e... params: release Geth v1.9.2
HEAD 目前位于 cfbb969... params: release Geth v1.9.3 stable

# 然后重新安装geth
mao@ubuntu:~/Downloads/go-ethereum$ make geth

# 查看修改之后的版本
mao@ubuntu:~/Downloads/go-ethereum$ geth version
Geth
Version: 1.9.3-stable
Git Commit: cfbb969da803d4cc92e1a64fc1b3c06db299b564
Architecture: amd64
Protocol Versions: [63]
Network Id: 1
Go Version: go1.15.6
Operating System: linux
GOPATH=/home/mao/work
GOROOT=/usr/local/go
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值