其他 - 03 Hyperledger Fabric 安装和运行

预先安装

注意:以下全部安装和配置都在 Ubuntu16.04.5-server-amd64 上进行
cURL

  • checck on Ubuntu16.04.5 (input command "curl --help")

Docker

  • version (17.06.2-ce or greater) (input command "docker --version")
  • How to install Docker on Ubuntu16.04.5 (See this)

Docker Compose

  • version (1.14.0 or greater) (input command "docker-compose --version")
  • How to install Docker Compose on Ubuntu16.04.5 (See this)

Go

  • version (1.11.x) (input command "go version")
  • GOPATH (export GOPATH=~/golang/gopath)
  • PATH (export PATH=$PATH:$GOPATH/bin)

下载源码

源码中含有样例,下载完成后切换到v1.3.0版本的源码

go get github.com/hyperledger/fabric
cd $GOPATH/src/github.com/hyperledger/fabric
git checkout -b v1.3.0

下载镜像

docker pull hyperledger/fabric-tools:amd64-1.3.0
docker pull hyperledger/fabric-peer:amd64-1.3.0
docker pull hyperledger/fabric-orderer:amd64-1.3.0
docker pull hyperledger/fabric-ca:amd64-1.3.0
docker pull hyperledger/fabric-couchdb:amd64-0.4.14
docker pull hyperledger/fabric-kafka:amd64-0.4.14
docker pull hyperledger/fabric-zookeeper:amd64-0.4.14
docker pull hyperledger/fabric-baseos:amd64-0.4.14

为了方便 docker-compose 的配置,将所有的镜像 tag 都改为 latest

docker tag hyperledger/fabric-tools:amd64-1.3.0 hyperledger/fabric-tools:latest
docker tag hyperledger/fabric-peer:amd64-1.3.0 hyperledger/fabric-peer:latest
docker tag hyperledger/fabric-orderer:amd64-1.3.0 hyperledger/fabric-orderer:latest
docker tag hyperledger/fabric-ca:amd64-1.3.0 hyperledger/fabric-ca:latest
docker tag hyperledger/fabric-couchdb:amd64-0.4.14 hyperledger/fabric-couchdb:latest
docker tag hyperledger/fabric-kafka:amd64-0.4.14 hyperledger/fabric-kafka:latest
docker tag hyperledger/fabric-zookeeper:amd64-0.4.14 hyperledger/fabric-zookeeper:latest
docker tag hyperledger/fabric-baseos:amd64-0.4.14 hyperledger/fabric-baseos:latest

这些镜像都比较大,下载过程请确保网络环境稳定速率快,否则容易中断失败

运行样例

cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli
# 这里的斜杠"/"需要转义
sed -i "s/\/opt\/gopath/\/home\/nealguo\/golang\/gopath/g" *.* base/*.* script/*.*  

启动过程中会用到很多配置文件和脚本,比如 docker-compose-cli.yaml、base/docker-compose-base.yaml、scripts/script.sh,这些配置文件和脚本中很多路径以 /opt/gopath 开头(即默认 $GOPATH 是 /opt/gopath),

如果 $GOPATH 是其他路径,需要修改这些配置文件和脚本,比如这里用 /home/nealguo/golang/gopath 替换 /opt/gopath(sed 命令参看这里

cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli
bash network_setup.sh up

这里运行样例 e2e_cli,关闭时可以使用命令 “bash network_setup.sh down”

参考

Fabric相关官方镜像》https://hub.docker.com/u/hyperledger/?page=1
Fabric源码及镜像文件处理》http://www.cnblogs.com/aberic/p/7532114.html
运行测试e2e》http://www.cnblogs.com/aberic/p/7532421.html

转载于:https://my.oschina.net/deltatech/blog/2253528

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值