在ubuntu虚拟机上安装go-ethereum

安装方式有两种:

1:从PPA中安装

主要是执行4条命令就可以了,这个比较简单

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum

2:从源代码中编译得到

因为go-ethereum是基于go语言开发,所以要有go开发环境才可以

2.1安装go

2.1.1 下载tar文件

curl -O https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz

如果报curl not found错误,可以先执行

sudo apt install curl

来安装curl

2.1.2 解压到/usr/local文件夹下

tar -C /usr/local -xzf go1.7.3.linux-amd64.tar.gz

2.1.3 配置go相关环境变量

mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc

echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc

最后执行source ~/.bashrc使设置的环境变量生效


2.2 下载go-ethereum源码

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


2.3 安装 Go and C compilers

sudo apt-get install -y build-essential golang


2.4 编译源码

make geth

编译成功后geth在build/bin目录下

猜你喜欢

转载自blog.csdn.net/wahaha13168/article/details/80998123