安装docker
yum -y install docker
docker version
启用docker官方中国区加速器:
vim /etc/sysconfig/docker
--registry-mirror=https://registry.docker-cn.com
service docker start
安装docker-compose(本节暂时未用到)
yum -y install epel-release
yum -y install python-pip
pip install --upgrade pip
pip install docker-compose
安装go
wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
tar -xvf go1.8.3.linux-amd64.tar.gz
mv go /usr/local/
mkdir -p /root/golang
vim /etc/profile
export GOPATH=/root/golang
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
source /etc/profile
为解决fabric编译报错:can't load package: package github.com/hyperledger/fabric/peer: open /opt/gopath/src/github.com/hyperledger/fabric/peer: permission denied
ln -s $GOPATH /opt/gopath
安装git
yum -y install git
Fabric源码下载
git clone https://github.com/hyperledger/fabric $GOPATH/src/github.com/hyperledger/fabric
git clone https://github.com/hyperledger/fabric-ca $GOPATH/src/github.com/hyperledger/fabric-ca
或
go get github.com/hyperledger/fabric
go get github.com/hyperledger/fabric-ca
编译fabric代码
cd $GOPATH/src/github.com/hyperledger/fabric
make all
cp build/bin/* $GOPATH/bin/
解决编译fabric过程中报错
如下为解决:package github.com/golang/lint/golint: mkdir /opt/gotools/obj/gopath: permission denied
git clone https://github.com/golang/tools.git $GOPATH/src/golang.org/x/tools
go get -u github.com/golang/lint/golint
go install github.com/golang/lint/golint
如下为解决:cp: cannot stat ‘build/docker/gotools/bin/protoc-gen-go’: No such file or directory
yum -y install protobuf
go get github.com/golang/protobuf/protoc-gen-go
cd $GOPATH/src/github.com/golang/protobuf/
gmake all
cd $GOPATH/src/github.com/hyperledger/fabric
cp $GOPATH/bin/protoc-gen-go build/docker/gotools/bin/
如下为解决:vendor/github.com/miekg/pkcs11/pkcs11.go:29:18: fatal error: ltdl.h: No such file or directory
yum -y install libtool-ltdl-devel
如下为解决:can't load package: package github.com/hyperledger/fabric-ca/cmd/fabric-ca-client: open /opt/gopath/src/github.com/hyperledger/fabric-ca/cmd/fabric-ca-client: permission denied
临时关闭selinux:su -c "setenforce 0"
参考文档:http://www.linuxidc.com/Linux/2015-03/115124.htm
编译fabric-ca代码
make all
网友评论