服务器环境 centos7
安装软件列表
yum install git
git clone fabric 到目录 /opt/gopath
yum install go 这种方式go是1.9版本
fabric需要安装1.10以上版本
yum install wget
wget https://studygolang.com/dl/golang/go1.10.3.linux-amd64.tar.gz
sudo tar -xzf go1.10.3.linux-amd64.tar.gz
yum install docker
docker服务启动命令
sudo service docker restart
python-pip 安装命令
yum -y install epel-release
yum -y install python-pip
编译 configtxgen
生成创世区块和证书
bash generateArtifacts.sh mychannel
查看创世区块信息
cd channel-artifacts
genesis.block
/opt/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen
docker-compose 安装命令
curl -L https://get.daocloud.io/docker/compose/releases/download/1.10.1/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
启动peer
docker-compose -f docker-compose-peer.yaml up –d
问题记录
make configtxgen 报错
CGO_CFLAGS=" " GOBIN=/opt/gopath/src/github.com/hyperledger/fabric/.build/bin go install -tags "experimental" -ldflags "-X github.com/hyperledger/fabric/common/tools/configtxgen/metadata.CommitSHA=5a6e862" github.com/hyperledger/fabric/common/tools/configtxgen
# github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive
vendor/github.com/docker/docker/pkg/archive/archive.go:364:5: hdr.Format undefined (type *tar.Header has no field or method Format)
vendor/github.com/docker/docker/pkg/archive/archive.go:364:15: undefined: tar.FormatPAX
vendor/github.com/docker/docker/pkg/archive/archive.go:1166:7: hdr.Format undefined (type *tar.Header has no field or method Format)
vendor/github.com/docker/docker/pkg/archive/archive.go:1166:17: undefined: tar.FormatPAX
解决办法:
fabric要求go版本大于等于1.10
升级go版本到1.10.3
docker 启动失败 报错
[root@linux-201-20 run]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
解决办法:
rm -rf /var/lib/docker/
# 添加如下内容 没搞明白为啥,反正就是行了
vim /etc/docker/daemon.json
{
"graph": "/mnt/docker-data",
"storage-driver": "overlay"
}
systemctl restart docker
systemctl status docker
orderer.example.com 未启动
解决办法:
运行
docker ps -a
结果:
orderer自己结束了
然后运行查看容器日志命令:
docker logs orderer.example.com
错误如下:
2018-08-01 01:39:31.787 UTC [orderer/commmon/multichannel] newLedgerResources -> CRIT 054 Error creating channelconfig bundle: initializing channelconfig failed: could not create channel Consortiums sub-group config: setting up the MSP manager failed: the supplied identity is not valid: x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")
panic: Error creating channelconfig bundle: initializing channelconfig failed: could not create channel Consortiums sub-group config: setting up the MSP manager failed: the supplied identity is not valid: x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")
goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panicf(0xc4202ab0b0, 0xd869e0, 0x27, 0xc4200103f0, 0x1, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:194 +0x126
github.com/hyperledger/fabric/orderer/common/multichannel.(*Registrar).newLedgerResources(0xc4202ae230, 0xc4206a8c60, 0xc4206a8c60)
/opt/gopath/src/github.com/hyperledger/fabric/o
解决办法:
未解决