CentOS8 配置以太坊私链

这个文章是写给公司的同事的,顺便自己也记录一下

参考连接/备注
远程工具 MobaXterm
https://www.cnblogs.com/nhdlb/p/11569191.html #Linux更新yum方法
我一般把应用都放在 /home/[username]/app/ #里面

cd /etc/yum.repos.d #进入yum配置文件夹
mv CentOS-Base.repo CentOS-Base.repo.old #备份原来的配置文件(如果没有那就跳过了)
wget http://mirrors.aliyun.com/repo/Centos-8.repo #下载阿里云镜像文件
mv Centos-8.repo CentOS-Base.repo #将新的源文件改成 CentOS-Base.repo
yum update -y #让yum重新缓存新的数据
等待更新结束

yum install git #安装git

#安装go语言环境 或者直接把下载好的复制到机器上
wget http://49.234.123.71:8018/software/go1.10.2.linux-amd64.tar.gz

tar zxvf go1.10.2.linux-amd64.tar.gz #解压
#配置环境变量
sudo vi /etc/profile
添加
export GOPATH=/home/username/app/go
export PATH=[前面的省略了]:$GOPATH/bin

git clone https://github.com/ethereum/go-ethereum.git #下载go-ethereum源代码,或者上传本地已经下载的
cd go-ethereum #进入文件夹
make geth #编译geth文件

/home/username/app/go-ethereum/build/bin #配置环境变量

#完事了 要是遇到 Permission denied
去到配置环境变量的bin目录 sudo chmod -R 777 * 即可

上传配置文件
geth --datadir data0 init init.json #初始化创世区块

在节点1输入
admin.addPeer(“enode://…”)

你可能感兴趣的:(区块链)