区块链:工具安装及环境搭建

一、安装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

二、安装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

三、安装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

四、安装Node.js

# 下载
wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz

# 解压,-zvxf会出错
tar -vxf node-v12.16.1-linux-x64.tar.xz

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

#在文件末尾加上配置
export PATH=${PATH}:/usr/install/node.js/node-v12.16.1/bin

#使脚本生效
source /etc/profile

# 查看版本
node -v

# 换源
npm config set registry https://registry.npm.taobao.org

五、安装Truffle

# 安装
npm install -g truffle

# 查看版本
truffle version

遇到这问题:Error: EACCES: permission denied, open '/root/.config/truffle/config.json'

直接简单粗暴解决:chmod 777 /root/.config

六、安装MetaMask

1.在线安装

打开谷歌浏览器,找到扩展程序,搜索MetaMask,直接安装即可。(需要翻墙)

2.离线安装

打开链接:https://github.com/MetaMask/metamask-extension/releases

找到chrome的插件,下载压缩包,解压。

 

 打开谷歌,输入chrome://extensions/,进入扩展插件页,打开开发者模式,加载已解压的扩展程序,选择刚刚解压的文件即可

猜你喜欢

转载自www.cnblogs.com/fdzang/p/12671202.html