56

Fabric环境搭建

 5 years ago
source link: https://studygolang.com/articles/15861?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

2018-10-27笔记

花了一天搭建的环境。

  1. 首先安装依赖
$ sudo apt update
$ sudo apt install -y libsnappy-def zlib1g-dev libbz2-dev libltdl-dev libtool
  1. 搭建go环境 ,并且安装 /maxbrunsfeld/counterfeitergolang/tools
  2. 搭建docker ,并且安装 docker-compose
  3. 安装 chaintool
$ cd /usr/local/bin
$ sudo wget https://github.com/hyperledger/fabric-chaintool/releases/download/v0.10.3/chaintool
$ chmod +x chaintool
  1. 下载 fabricfabric-ca 源码
$ mkdir -p $GOPATH/src/github.com/hyperledger
$ cd $GOPATH/src/github.com/hyperledger
$ git clone --single-branch -b master --depth 1 https://github.com/hyperledger/fabric.git
$ git clone --single-branch -b master --depth 1 https://github.com/hyperledger/fabric-ca.git
  1. 安装 protoc-gen-go (使用 go get 或者 git clone + go install
$ go get -u github.com/golang/protobuf/protoc-gen-go
$ cd $GOPATH/src/github.com/hyperledger/fabric
$ mkdir -p .build/docker/gotools/bin/
$ ln -s $GOPATH/bin/protoc-gen-go  $PWD/.build/docker/gotools/bin/
  1. 制作docker镜像
$ cd $GOPATH/src/github.com/hyperledger/fabric-ca
$ make docker

重开一个终端,两个一次 make ,节省时间

$ cd $GOPATH/src/github.com/hyperledger/fabric
$ make docker  # !!特别久!!

至此环境搭建完毕了,整理完后,回头看搭建过程其实也没有那么复杂了。主要是解决了 go get 不稳定时候的问题,然后还有 docker 的国内镜像加速。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK