centos7下源代码方式安装fabric1.0

莫名FCJ · · 1001 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

安装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


有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:莫名FCJ

查看原文:centos7下源代码方式安装fabric1.0

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1001 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传