0.安装python,pip
$ sudo apt-get install python
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py1.编译 configtxgen
# cd $GOPATH/src/github.com/hyperledger/fabric # make configtxgen
如果出错:'ltdl.h' file not found sudo apt install libtool libltdl-dev 然后再运行make # make configtxgen
2.编译成功文件放在fabric目录下的build/bin/configtxgen中
build/bin/configtxgen CGO_CFLAGS=" " GOBIN=/Users/johndoe/work/src/github.com/hyperledger/fabric/build/bin go install -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0-snapshot-8d3275f -X github.com/hyperledger/fabric/common /metadata.BaseVersion=0.3.0 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric" github.com/hyperledger/fabric/common/configtx/tool/configtxgen Binary available as build/bin/configtxgen``
3.e2e_cli样例测试环境,进入examples/e2e_cli目录
$ sudo chmod +x download-dockerimages.sh
需要注意,修改这个文件内容,下载1.0.0而不是1.0.0-beta
./download-dockerimages.sh
下载docker镜像
ubuntu@VM-0-13-ubuntu:/opt/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest f2a91732366c 4 months ago 1.85kB hyperledger/fabric-tools latest ae6b0f53cb70 10 months ago 1.32GB hyperledger/fabric-tools x86_64-1.0.0-beta ae6b0f53cb70 10 months ago 1.32GB hyperledger/fabric-couchdb latest 31bbbec3d853 10 months ago 1.48GB hyperledger/fabric-couchdb x86_64-1.0.0-beta 31bbbec3d853 10 months ago 1.48GB hyperledger/fabric-kafka latest c4ac1c9a4797 10 months ago 1.3GB hyperledger/fabric-kafka x86_64-1.0.0-beta c4ac1c9a4797 10 months ago 1.3GB hyperledger/fabric-zookeeper latest 2c4ebacb6f00 10 months ago 1.31GB hyperledger/fabric-zookeeper x86_64-1.0.0-beta 2c4ebacb6f00 10 months ago 1.31GB hyperledger/fabric-orderer latest 11ff350dd297 10 months ago 179MB hyperledger/fabric-orderer x86_64-1.0.0-beta 11ff350dd297 10 months ago 179MB hyperledger/fabric-peer latest e01c2b645f11 10 months ago 182MB hyperledger/fabric-peer x86_64-1.0.0-beta e01c2b645f11 10 months ago 182MB hyperledger/fabric-javaenv latest 61c188dca542 10 months ago 1.42GB hyperledger/fabric-javaenv x86_64-1.0.0-beta 61c188dca542 10 months ago 1.42GB hyperledger/fabric-ccenv latest 7034cca1918d 10 months ago 1.29GB hyperledger/fabric-ccenv x86_64-1.0.0-beta 7034cca1918d 10 months ago 1.29GB hyperledger/fabric-ca latest e549e8c53c2e 10 months ago 238MB hyperledger/fabric-ca x86_64-1.0.0-beta e549e8c53c2e 10 months ago 238MB
4.执行命令启动网络
$ sudo ./network_setup.sh up <channl id>
$ sudo ./network_setup.sh down
启动报错,是sodu环境变量的问题,可以编辑/etc/sudoers文件把Defaults env_reset改成Defaults !env_reset
make: Entering directory '/opt/gopath/src/github.com/hyperledger/fabric' can't load package: package github.com/hyperledger/fabric/core/chaincode/shim: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of: /usr/local/go/src/github.com/hyperledger/fabric/core/chaincode/shim (from $GOROOT) /home/ubuntu/go/src/github.com/hyperledger/fabric/core/chaincode/shim (from $GOPATH) find: ‘/src/github.com/hyperledger/fabric/core/chaincode/shim’: No such file or directory
===================== Query on PEER3 on channel 'mychannel' is successful ===================== ===================== All GOOD, End-2-End execution completed ===================== _____ _ _ ____ _____ ____ _____ | ____| | \ | | | _ \ | ____| |___ \ | ____| | _| | \| | | | | | _____ | _| __) | | _| | |___ | |\ | | |_| | |_____| | |___ / __/ | |___ |_____| |_| \_| |____/ |_____| |_____| |_____|出现以上界面,说明测试通过