安装所需基础工具

yum update -y && yum install git wget bzip2 vim gcc-c++ ntp epel-release nodejs cmake -y

安装GO

yum -y install golang

#查看版本
go version

#编辑配置
vi /root/.bashrc

#添加
export GOPATH=/opt/gopath
export GOROOT=/usr/lib/golang
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN

#生效
source /root/.bashrc

更新GIT

#安装源

yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm

#安装git

yum install git

#更新git

yum update git

克隆编译项目go-ethereum

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

cd go-ethereum

make all

在path中加入geth路径

echo 'export PATH=$PATH:/root/go-ethereum/build/bin' >> /etc/profile
source /etc/profile

查看版本

geth version

配置

##创建目录
mkdir ethdir

# 生成配置文件
geth --syncmode 'fast' --rpc --rpcaddr '0.0.0.0' --rpcport 8545 --datadir /opt/ethdir/data --port '30303' --rpcapi 'db,eth,net,web3,personal' --rpccorsdomain '*' --networkid 4 --cache 1024 dumpconfig > /opt/ethdir/config.toml

#选项说明
https://blog.csdn.net/zhangnero/article/details/96133289

# 后台启动geth节点
nohup geth --config /opt/ethdir/config.toml >> /opt/ethdir/geth.log  2>&1  &
©2019 Somore 豫ICP备19009951号 sqlixiaoli@163.com