参考:给了个链接:
http://www.voidcn.com/article/p-szuznezg-bqr.html
首先说明,这里的装法是过时的,网上类似的文章一抓一大把,到最后是肯定装不成功的
会卡在最后一步network-stup.sh up
,报错
2018-04-25 03:09:49.100 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host"; Reconnecting to {orderer.example.com:7050 <nil>}
Error: Error connecting due to rpc error: code = Unavailable desc = grpc: the connection is unavailable
错误如上,咋一看好像是什么host,docker ps -a才发现
e170bd588a44 hyperledger/fabric-orderer "orderer" 3 minutes ago Exited (2) 3 minutes ago
是orderer这个容器启动失败了, docker logs e170bd588a44查看:
2018-04-25 03:08:48.253 UTC [orderer/multichain] newLedgerResources -> CRIT 067 Error creating configtx manager and handlers: Error deserializing key Capabilities for group /Channel: Unexpected key Capabilities
panic: Error creating configtx manager and handlers: Error deserializing key Capabilities for group /Channel: Unexpected key Capabilities
goroutine 1 [running]:
panic(0xb31bc0, 0xc42020f160)
/opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panicf(0xc420212540, 0xc71091, 0x30, 0xc42020f0b0, 0x1, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:194 +0x127
github.com/hyperledger/fabric/orderer/multichain.(*multiLedger).newLedgerResources(0xc420374730, 0xc42035d350, 0xc42035d350)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/multichain/manager.go:164 +0x393
github.com/hyperledger/fabric/orderer/multichain.NewManagerImpl(0x122a2a0, 0xc420388100, 0xc42035ce40, 0x1226ea0, 0x126ee88, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/multichain/manager.go:114 +0x23b
main.initializeMultiChainManager(0xc4201df440, 0x1226ea0, 0x126ee88, 0xc42020ea90, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:219 +0x27a
main.main()
/opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:75 +0x392
key的兼容性,shit,整整调试了两天,才搞定
完整安装步骤如下:
一、弄好源
yum install -y wget
rm -rf /etc/yum.repos.d/*
wget -q http://mirrors.163.com/.help/CentOS7-Base-163.repo -O /etc/yum.repos.d/CentOS7-Base-163.repo
二、校准时间
yum install -y ntp ntpdate ntp-doc
ntpdate 0.us.pool.ntp.org
hwclock --systohc
systemctl enable ntpd.service
systemctl start ntpd.service
三、升级核心,安装开发包
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum install lsof deltarpm -y
yum -y --enablerepo=elrepo-kernel install kernel-ml # will install 3.11.latest,stable, mainline
yum groupinstall -y "development tools"
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-set-default 0
reboot
以上三步其实也可以省略,嘿嘿,掉坑了吧
四、装Docker和docker-compose
yum install -y docker
systemctl enable docker
systemctl start docker
curl -L https://get.daocloud.io/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
五、安装go,1.7.5的版本,因为我看了Fabric的ci,是用的1.7.5,我们就对准好了
wget https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz
tar xf go1.7.5.linux-amd64.tar.gz
mv go /usr/local/
mkdir -p /root/golang
cat<<EOF>>/etc/profile
export GOPATH=/root/golang
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
EOF
ln -s /root/golang /opt/gopath
source /etc/profile
六、clone Fabric
yum install git -y
yum update nss curl
git clone -b release-1.0 https://github.com/hyperledger/fabric
网上的错误都在于此,都是去clone了master分支的,然后checkout -b v1.0.0,这样是不对的,必须去clone这个独立的release-1.0分支。 升级nss和curl的原因是我的Centos 7是CentOS Linux release 7.1.1503 (Core)
,够古老,不升级git会报错。
七、下载docker镜像
cd /root/golang/src/github.com/hyperledger/fabric/examples/e2e_cli
source download-dockerimages.sh -c x86_64-1.0.6 -f x86_64-1.0.6
注意这里,实际release-1.0的版本号是1.0.6,所以下1.0.6的,最好用代理下,或者什么阿里或者daocloud的加速器下,方法如下:
启用docker官方中国区加速器:
vim /etc/sysconfig/docker
OPTIONS=‘--selinux-enabled --log-driver=journald --signature-verification=false --registry-mirror=https://registry.docker-cn.com‘
systemctl restart docker
八、搞定
cd /root/golang/src/github.com/hyperledger/fabric/examples/e2e_cli
./network_setup.sh up