Centos7
Fabric 1.4.1
Docker 18.3
Docker-compose 1.14.0
GoLang 1.11.5
下载docker-ce rpm文件
安装docker-ce
启动docker
测试 docker version
[root@localhost ~]# docker version Client: Version: 18.03.1-ce API version: 1.37 Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:20:16 2018 OS/Arch: linux/amd64 Experimental: false Orchestrator: swarm Server: Engine: Version: 18.03.1-ce API version: 1.37 (minimum version 1.12) Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:23:58 2018 OS/Arch: linux/amd64 Experimental: false
配置镜像加速器
这里选择的是阿里云的镜像加速器:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors,不配置镜像加速器下载速度很慢。
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-‘EOF‘ { "registry-mirrors": ["加速器地址"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker
测试
[root@localhost ~]# docker-compose version docker-compose version 1.14.0, build c7bdf9e docker-py version: 2.3.0 CPython version: 2.7.13 OpenSSL version: OpenSSL 1.0.1t 3 May 2016
在gopath下创建目录并进入。(gopath 默认为/root/go,可以通过 go env | grep GOPATH查看)
拉取1.4.1版本的farbic源码
由于 e2e 网络在 Fabric1.4 已经移除,所以测试网络使用 fabric-samples
中的 first-network
。
可以在 fabric/scripts
目录下找到 bootstrap.sh
脚本
该脚本会帮你干很多事情:
hyperledger/fabric-samples
,会从 github.com
克隆 hyperledger/fabric-samples
存储库;Hyperledger Fabric
平台特定的二进制文件和配置文件安装到 fabric-samples
存储库的根目录中;Hyperledger Fabric Docker
镜像文件;查看 bootstrap.sh
脚本,该脚本主要帮我们干以下三件事,一般会卡在 binariesInstall 步骤,我们可以手动完成这三个步骤。
if [ "$SAMPLES" == "true" ]; then echo echo "Installing hyperledger/fabric-samples repo" echo samplesInstall fi if [ "$BINARIES" == "true" ]; then echo echo "Installing Hyperledger Fabric binaries" echo binariesInstall fi if [ "$DOCKER" == "true" ]; then echo echo "Installing Hyperledger Fabric docker images" echo dockerInstall fi
(1) 下载 fabric-samples
源码
查看 bootstrap.sh 脚本:
samplesInstall() { # clone (if needed) hyperledger/fabric-samples and checkout corresponding # version to the binaries and docker images to be downloaded if [ -d first-network ]; then # if we are in the fabric-samples repo, checkout corresponding version echo "===> Checking out v${VERSION} of hyperledger/fabric-samples" git checkout v${VERSION} elif [ -d fabric-samples ]; then # if fabric-samples repo already cloned and in current directory, # cd fabric-samples and checkout corresponding version echo "===> Checking out v${VERSION} of hyperledger/fabric-samples" cd fabric-samples && git checkout v${VERSION} else echo "===> Cloning hyperledger/fabric-samples repo and checkout v${VERSION}" git clone -b master https://github.com/hyperledger/fabric-samples.git && cd fabric-samples && git checkout v${VERSION} fi }
其实就是将 fabric-samples
源码克隆到fabric同级目录下,并切换到指定版本:
(2) 下载可执行二进制文件
下载指定版本的 Hyperledger Fabric
平台特定的二进制文件和配置文件,查看 bootstrap.sh 脚本:
binariesInstall() { echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries" binaryDownload "${BINARY_FILE}" "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/${BINARY_FILE}" if [ $? -eq 22 ]; then echo echo "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----" echo fi echo "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary" binaryDownload "${CA_BINARY_FILE}" "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/${ARCH}-${CA_VERSION}/${CA_BINARY_FILE}" if [ $? -eq 22 ]; then echo echo "------> ${CA_TAG} fabric-ca-client binary is not available to download (Available from 1.1.0-rc1) <----" echo fi }
该脚本从下面两个链接中下载二进制文件,我们直接访问该页面,选择相应的版本下载即可,此处选择的是 linux-amd64-1.4.3
版本
下载的 hyperledger-fabric-linux-amd64-1.4.1.tar
压缩包内有 bin 和 config 两个文件夹,hyperledger-fabric-ca-linux-amd64-1.4.1.tar
压缩包内有 bin 文件夹,将两个 bin 文件夹内的二进制文件汇总在一个 bin 文件夹内。 最后将 bin 和 config 文件夹复制到 fabric-samples
文件夹内。
由于上面链接无法访问,可以去github相应项目中下载。
(3)下载 Docker镜像
上一个步骤的下载 hyperledger-fabric-linux-amd64-1.4.1.tar
的 bin 文件夹下还有一个 get-docker-images.sh
脚本,可以运行该脚本下载镜像,但是该脚本不会下载 fabric-ca
和 fabric-javaenv
镜像,所以不推荐。
转到 bootstrap.sh
脚本同级目录下,将 bootstrap.sh
中 174、175行SAMPLES、BINARIES改为false,即不执行下载fabric-samples和下载二进制脚本
执行 bootstrap.sh
脚本:
【Fabric】Hyperledger Fabric1.4.1 安装
原文:https://www.cnblogs.com/jxd283465/p/13396330.html