当前位置: 代码迷 >> 综合 >> Hyperledger Fabric 1.4环境搭建【详尽】
  详细解决方案

Hyperledger Fabric 1.4环境搭建【详尽】

热度:74   发布时间:2023-12-06 06:35:45.0

操作系统:Ubuntu 16.04/18.04

1. 安装依赖工具

1.1 go语言

test@ubuntu :~/Soft$ wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gztest@ubuntu :~/Soft$ sudo tar -zxvf go1.14.2.linux-amd64.tar.gz -C /opttest@ubuntu :~/Soft$ echo "export GOROOT=/opt/go" >> ~/.bashrc
test@ubuntu :~/Soft$ echo "export GOPATH=/opt/gopath" >> ~/.bashrc
test@ubuntu :~/Soft$ echo "export PATH=\$GOROOT/bin:\$GOPATH/bin:\$PATH" >>  ~/.bashrctest@ubuntu :~/Soft$ . ~/.bashrc test@ubuntu :~/Soft$ go version
go version go1.14.2 linux/amd64

go语言的配置可以自由选择

1.2 docker

test@ubuntu-bionic:~/Soft$ curl -fsSL https://get.docker.com -o get-docker.sh
test@ubuntu-bionic:~/Soft$ sudo sh get-docker.sh 
test@ubuntu-bionic:~/Soft$ sudo usermod -aG docker $USER
test@ubuntu-bionic:~/Soft$ sudo systemctl restart docker
test@ubuntu-bionic:~$ docker version
Client: Docker Engine - CommunityVersion:           19.03.8API version:       1.40Go version:        go1.12.17Git commit:        afacb8b7f0Built:             Wed Mar 11 01:25:46 2020OS/Arch:           linux/amd64Experimental:      falseServer: Docker Engine - CommunityEngine:Version:          19.03.8API version:      1.40 (minimum version 1.12)Go version:       go1.12.17Git commit:       afacb8b7f0Built:            Wed Mar 11 01:24:19 2020OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.2.13GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429runc:Version:          1.0.0-rc10GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dddocker-init:Version:          0.18.0GitCommit:        fec3683

1.3 docker-compose

vagrant@ubuntu-bionic:~$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composevagrant@ubuntu-bionic:~$ sudo chmod 755 /usr/local/bin/docker-composevagrant@ubuntu-bionic:~$ docker-compose --version
docker-compose version 1.25.4, build 8d51620a

2 源码及镜像下载

2.1 源码下载

vagrant@ubuntu-bionic:~$ mkdir -p $GOPATH/src/github.com/hyperledger
vagrant@ubuntu-bionic:~$ cd $GOPATH/src/github.com/hyperledger
vagrant@ubuntu-bionic:/opt/gopath/src/github.com/hyperledger$ git clone https://github.com/hyperledger/fabric-samples.git

2.2 切换分支

[vagrant@RUAN:/opt/gopath/src/github.com/hyperledger/fabric-samples] (master)$ git checkout -b v1.4.6 v1.4.6
Switched to a new branch 'v1.4.6'

2.3 下载引导脚本

[vagrant@RUAN:/opt/gopath/src/github.com/hyperledger/fabric-samples] (v1.4.6)$ curl -sS https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh -o ./scripts/bootstrap.sh[vagrant@RUAN:/opt/gopath/src/github.com/hyperledger/fabric-samples] (v1.4.6)$ chmod +x scripts/bootstrap.sh

2.4 下载必备二进制文件和docker镜像

# ./scripts/bootstrap.sh [version] [ca version] [thirdparty_version]
[vagrant@RUAN:/opt/gopath/src/github.com/hyperledger/fabric-samples] (v1.4.6)$ ./scripts/bootstrap.sh 1.4.6 1.4.6 0.4.18 -s

2.4.1 下载Hyperledger Fabric 二进制包

===> Downloading version 1.4.6 platform specific fabric binaries
===> Downloading:  https://github.com/hyperledger/fabric/releases/download/v1.4.6/hyperledger-fabric-linux-amd64-1.4.6.tar.gz===> Downloading version 1.4.6 platform specific fabric-ca-client binary
===> Downloading:  https://github.com/hyperledger/fabric-ca/releases/download/v1.4.6/hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz

2.4.2 拉取docker镜像

Pull Hyperledger Fabric docker images
FABRIC_IMAGES: peer orderer ccenv tools javaenv
===> Pulling fabric Images====> hyperledger/fabric-peer:1.4.6
1.4.6: Pulling from hyperledger/fabric-peer====> hyperledger/fabric-orderer:1.4.6
1.4.6: Pulling from hyperledger/fabric-orderer====> hyperledger/fabric-ccenv:1.4.6
1.4.6: Pulling from hyperledger/fabric-ccenv====> hyperledger/fabric-tools:1.4.6
1.4.6: Pulling from hyperledger/fabric-tools====> hyperledger/fabric-javaenv:1.4.6
1.4.6: Pulling from hyperledger/fabric-javaenv====> hyperledger/fabric-ca:1.4.6
1.4.6: Pulling from hyperledger/fabric-ca===> Pulling thirdparty docker images
====> hyperledger/fabric-zookeeper:0.4.18
0.4.18: Pulling from hyperledger/fabric-zookeeper====> hyperledger/fabric-kafka:0.4.18
0.4.18: Pulling from hyperledger/fabric-kafka====> hyperledger/fabric-couchdb:0.4.18
0.4.18: Pulling from hyperledger/fabric-couchdb===> List out hyperledger docker images
hyperledger/fabric-javaenv     1.4                 68914607b3a5        6 weeks ago         1.68GB
hyperledger/fabric-javaenv     1.4.6               68914607b3a5        6 weeks ago         1.68GB
hyperledger/fabric-javaenv     latest              68914607b3a5        6 weeks ago         1.68GB
hyperledger/fabric-ca          1.4                 3b96a893c1e4        7 weeks ago         150MB
hyperledger/fabric-ca          1.4.6               3b96a893c1e4        7 weeks ago         150MB
hyperledger/fabric-ca          latest              3b96a893c1e4        7 weeks ago         150MB
hyperledger/fabric-tools       1.4                 0f9743ac0662        7 weeks ago         1.49GB
hyperledger/fabric-tools       1.4.6               0f9743ac0662        7 weeks ago         1.49GB
hyperledger/fabric-tools       latest              0f9743ac0662        7 weeks ago         1.49GB
hyperledger/fabric-ccenv       1.4                 191911f4454f        7 weeks ago         1.36GB
hyperledger/fabric-ccenv       1.4.6               191911f4454f        7 weeks ago         1.36GB
hyperledger/fabric-ccenv       latest              191911f4454f        7 weeks ago         1.36GB
hyperledger/fabric-orderer     1.4                 84eaba5388e7        7 weeks ago         120MB
hyperledger/fabric-orderer     1.4.6               84eaba5388e7        7 weeks ago         120MB
hyperledger/fabric-orderer     latest              84eaba5388e7        7 weeks ago         120MB
hyperledger/fabric-peer        1.4                 5a52faa5d8c2        7 weeks ago         128MB
hyperledger/fabric-peer        1.4.6               5a52faa5d8c2        7 weeks ago         128MB
hyperledger/fabric-peer        latest              5a52faa5d8c2        7 weeks ago         128MB
hyperledger/fabric-zookeeper   0.4                 ede9389347db        5 months ago        276MB
hyperledger/fabric-zookeeper   0.4.18              ede9389347db        5 months ago        276MB
hyperledger/fabric-zookeeper   latest              ede9389347db        5 months ago        276MB
hyperledger/fabric-kafka       0.4                 caaae0474ef2        5 months ago        270MB
hyperledger/fabric-kafka       0.4.18              caaae0474ef2        5 months ago        270MB
hyperledger/fabric-kafka       latest              caaae0474ef2        5 months ago        270MB
hyperledger/fabric-couchdb     0.4                 d369d4eaa0fd        5 months ago        261MB
hyperledger/fabric-couchdb     0.4.18              d369d4eaa0fd        5 months ago        261MB
hyperledger/fabric-couchdb     latest              d369d4eaa0fd        5 months ago        261MB

请耐心等待,很需要时间

2.4.3 启动验证

进入到first-network目录下并启动网络
[test@RUAN:~]$ cd /opt/gopath/src/github.com/hyperledger/fabric-samples/first-network
[test@RUAN:/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network] (v1.4.6)$ ./byfn.sh up 

能顺利跑完就说明没有问题

  相关解决方案