centos7下源代碼方式安裝fabric1.0

安裝docker

yum -y install docker
docker version
啟用docker官方中國區(qū)加速器:
vim /etc/sysconfig/docker
--registry-mirror=https://registry.docker-cn.com
service docker start

安裝docker-compose(本節(jié)暫時未用到)

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
臨時關(guān)閉selinux:su -c "setenforce 0"
參考文檔:http://www.linuxidc.com/Linux/2015-03/115124.htm

編譯fabric-ca代碼

make all

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容