1. 修改deb更新地址
略
2. 安装docker
sudo apt-get install docker
3. 安装curl
sudo apt-get install curl
4. 安装go
下载go安装包
wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz
解压
tar -C /usr/local -xzf go1.9.linux-amd64.tar.gz
环境变量设置见第5步。
5. 安装nodejs
从这里下 https://npm.taobao.org/mirrors/node/
随便选择版本,我这里选择的6.11.3 LTS版.
cd ~
echo $PWD
/home/johnny
wget https://npm.taobao.org/mirrors/node/v6.11.3/node-v6.11.3-linux-x64.tar.gz
tar -C ~/ -zxf node-v6.11.3-linux-x64.tar.gz
编辑.profile增加nodejs路径
vi ~/.profile
在最后增加
PATH="/usr/local/go/bin:$HOME/node-v6.11.3-linux-x64/bin:$PATH"
source ~/.profile
6. 设置docker国内镜像
vi /etc/default/docker
增加
DOCKER_OPTS="--registry-mirror=https://docker.mirrors.ustc.edu.cn"
重启docker
sudo service docker restart
7. 下载fabric镜像
docker pull hyperledger/fabric-orderer:x86_64-1.0.2
docker pull hyperledger/fabric-peer:x86_64-1.0.2
docker pull hyperledger/fabric-zookeeper:x86_64-1.0.2
docker pull hyperledger/fabric-couchdb:x86_64-1.0.2
docker pull hyperledger/fabric-kafka:x86_64-1.0.2
docker pull hyperledger/fabric-ca:x86_64-1.0.2
docker pull hyperledger/fabric-ccenv:x86_64-1.0.2
docker pull hyperledger/fabric-javaenv:x86_64-1.0.2
docker pull hyperledger/fabric-tools:x86_64-1.0.2
docker tag hyperledger/fabric-orderer:x86_64-1.0.2 hyperledger/fabric-orderer:latest
docker tag hyperledger/fabric-peer:x86_64-1.0.2 hyperledger/fabric-peer:latest
docker tag hyperledger/fabric-zookeeper:x86_64-1.0.2 hyperledger/fabric-zookeeper:latest
docker tag hyperledger/fabric-couchdb:x86_64-1.0.2 hyperledger/fabric-couchdb:latest
docker tag hyperledger/fabric-kafka:x86_64-1.0.2 hyperledger/fabric-kafka:latest
docker tag hyperledger/fabric-ca:x86_64-1.0.2 hyperledger/fabric-ca:latest
docker tag hyperledger/fabric-ccenv:x86_64-1.0.2 hyperledger/fabric-ccenv:latest
docker tag hyperledger/fabric-javaenv:x86_64-1.0.2 hyperledger/fabric-javaenv:latest
docker tag hyperledger/fabric-tools:x86_64-1.0.2 hyperledger/fabric-tools:latest
8. 下载fabric项目源码
cd /home/johnny/dev/github
git clone https://github.com/hyperledger/fabric.git
验证: | |
---|---|
git clone https://github.com/hyperledger/fabric-ca.git | |
执行下面的命令,搭建一个fabricV1.0 beta 网络,包括:6 个docker image,其中包含4 个peer 节点(peer0,peer1,peer2, | |
peer3),一个order service 节点,以及一个CLI 节点用于执行命令 | |
cd $GOPATH/src/github.com/hyperledger/fabric | |
./network_setup.sh up | |
成功标志如下: | |
===================== Query on PEER3 on channel 'mychannel' is successful ===================== | |
===================== All GOOD, End-2-End execution completed ===================== | |
可以通过 docker ps 找到相关节点进程 | |
关闭fabricV1.0 beta 网络, 用以下命令 | |
./network_setup.sh down |