fabric源码编译,安装

直接撸命令

1、准备必须的环境:godockergit,网上教程很多。
2、准备必须的第三方工具:

$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.io,direct 
$ sudo mkdir -p $GOPATH/src/golang.org/x
$ cd $GOPATH/src/golang.org/x
$ git clone https://github.om/golang/tools.git
$ got get -u github.com/gpmgp/gopm
$ go get github.com/kardianos/govendor
$ go get golang.org/x/tools/cmd/goimports
$ go get github.com/client9/misspell/cmd/misspell
$ go get github.com/onsi/ginkgo/ginkgo
$ go get github.com/axw/gocov/...
$ go get github.com/AlekSi/goco-xml
$ go get github.com/golang/protobuf/protoc-gen-go
$ sudo apt-get install libltdl-dev
$ cd $GOPATH/src/github.com
$ git clone https://github.com/golang/lint.git
$ cd lint.git
$ go install

3、下载最新的fabric源码

$ cd $GOPATH/src/github.com/hyperledger
$ git clone https://github.com/hyperledger/fabric.git	#源码下载
$ cd fabric
$ git checkout v2.0.1	#版本切换
$ make release	#编译所有可执行文件
$ make docker	#创建所需要的容器
$ cp -r /home/gopath/src/github.com/hyperledger/fabric/release/linux-amd64/bin /home/gopath/src/github.com/hyperledger/fabric/build/bin
$ ls /home/gopath/src/github.com/hyperledger/fabric/build/bin
# 输出结果为:
configtxgen  configtxlator  cryptogen  discover  idemixgen  orderer  peer

4、设置环境变量

$ sudo vim /etc/profile
# 在文件最后后面添加:
export PATH=$PATH:/home/gopath/src/github.com/hyperledger/fabric/build/bin
export PATH=$PATH:/home/gopath/src/github.com/hyperledger/fabric/sampleconfig
# 然后退出编辑:先按Esc,再输入":wq"进行回车保存
$ source /etc/profile

至此完成对fabric的部署

你可能感兴趣的:(fabric)