区块链:以太坊基础之安装Geth

1.安装cmake

智能合约需要cmake3.x版本才可以编译

# 下载包
wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
# 解压
tar zxvf cmake-3.3.2.tar.gz
cd cmake-3.3.2

# 安装
./configure
make
make install

# 编辑环境变量配置文件
vim /etc/profile

# 在末尾加上
export PATH=/usr/cmake/cmake-3.3.2/bin:$PATH

# 重新加载系统配置文件
source /etc/profile

# 查看并确认cmake版本信息
cmake --version

2.安装golang

这里最好安装最新版本的,不然容易出错

# 下载包
wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
# 解压
tar zxvf go1.13.linux-amd64.tar.gz

# 编辑环境变量配置文件
vim /etc/profile

# 在末尾加上
export GOROOT=/usr/golang/go
export PATH=/usr/golang/go/bin:$PATH

# 重新加载系统配置文件
source /etc/profile

# 查看版本信息
go version

3.下载git

# 安装依赖
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

# 拉取Git源码包
wget https://github.com/git/git/archive/v2.23.0.tar.gz

# 解压
tar -zxvf  v2.23.0.tar.gz
cd git-2.23.0/

# 安装
make prefix=/usr/git/git-2.23.0 all
make prefix=/usr/git/git-2.23.0 install

#编辑环境变量
vim /etc/profile

#在文件末尾加上配置
export PATH=${PATH}:/usr/git/git-2.23.0/bin

#使脚本生效
source /etc/profile

#测试git环境
git --version

4.下载geth

# 下载源码
git clone https://github.com/ethereum/go-ethereum.git  

# 进入目录
cd go-ethereum/

# 安装
make all

#编辑环境变量
vim /etc/profile

#在文件末尾加上配置
export PATH=${PATH}:/usr/geth/go-ethereum/build/bin

#使脚本生效
source /etc/profile

# 查看版本
geth version

这里有个问题,如果安装报错,可能是/build/env.sh导致的,这个是因为win跟liunx换行符的不同

# 编辑
vim /usr/go-ethereum/build/env.sh # 设置换行,退出 :set ff=unix :wq

至此环境配置完成

猜你喜欢

转载自www.cnblogs.com/fdzang/p/12149844.html
今日推荐