如何安装Hyperledger Fabric 1.2

2019-01-22  本文已影响0人  SeanC52111

注: 这里使用的是全新安装的ubuntu 16.04 LTS 操作系统。

sudo apt-get update

安装curl和软件包以设置Docker存储库

sudo apt-get install curl apt-transport-https ca-certificates software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
docker --version
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

下载并配置Go语言的编程环境

注: 可以通过 https://golang.org/dl/ 来查看最新的稳定版本,并通过编辑 *.tar.gz来确定下载的二进制文件

curl -O https://storage.googleapis.com/golang/go1.10.3.linux-amd64.tar.gz
sha256sum go1.10.3.linux-amd64.tar.gz
tar -xvf go1.10.3.linux-amd64.tar.gz
sudo mv go /usr/local
sudo vim ~/.profile
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
source ~/.profile

安装Node.js

注:这里我们需要站桩Ubuntu的一些packages,并且重新根据源代码编译Node.js因为Hyperledger 1.2 只支持Node.js 8.9+ <9的版本。

sudo apt-get update
sudo apt-get install build-essential openssl libssl-dev pkg-config
cd /usr/local/src
sudo mkdir node
cd node
sudo wget [https://nodejs.org/dist/v8.9.3/node-v8.9.3.tar.gz](https://nodejs.org/dist/v8.9.3/node-v8.9.3.tar.gz)
sudo tar zxvf node-v8.9.3.tar.gz
cd node-v8.9.3
sudo ./configure
sudo make
sudo make install
node --version
sudo npm install npm@5.6.0 -g
npm --version

下载Fabric的引导脚本bootstrap.sh

$ cd ~
$ mkdir hyperledger-fabric
$ cd hyperledger-fabric
$ curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-1.2/scripts/bootstrap.sh -o bootstrap.sh
$ ls
bootstrap.sh
$ cd ~/hyperledger-fabric/
$ chmod 755 bootstrap.sh
$ sudo ./bootstrap.sh 1.2.0 1.2.0 0.4.10
$ vi ~/.bashrc
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:/home/blockchain/hyperledger-fabric/fabric-samples/bin
$ source ~/.bashrc
$ fabric-ca-client version
fabric-ca-client:
 Version: 1.2.0
 Go version: go1.10
 OS/Arch: linux/amd64

创建和管理网络

$ cd ~/hyperledger-fabric/fabric-samples/first-network/
$ ./byfn.sh generate
Generating certs and genesis block for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
.......
$ ./byfn.sh up
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
LOCAL_VERSION=1.2.0
DOCKER_IMAGE_VERSION=1.2.0
Creating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating peer0.org2.example.com ... done
Creating orderer.example.com    ... done
Creating peer0.org1.example.com ... done
Creating peer1.org1.example.com ... done
Creating peer1.org2.example.com ... done
Creating cli                    ... done

 ____    _____      _      ____    _____ 
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |  
 ___) |   | |    / ___ \  |  _ <    | |  
|____/    |_|   /_/   \_\ |_| \_\   |_|  

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
.......
$ ./byfn.sh down
Stopping for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
Stopping cli                    ... done
Stopping peer0.org1.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping orderer.example.com    ... done
Stopping peer1.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Removing cli                    ... done
Removing peer0.org1.example.com ... done
Removing peer1.org2.example.com ... done
Removing orderer.example.com    ... done
Removing peer1.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing network net_byfn
Removing volume net_orderer.example.com
Removing volume net_peer0.org1.example.com
Removing volume net_peer1.org1.example.com
Removing volume net_peer0.org2.example.com
Removing volume net_peer1.org2.example.com
Removing volume net_peer0.org3.example.com
WARNING: Volume net_peer0.org3.example.com not found.
Removing volume net_peer1.org3.example.com
WARNING: Volume net_peer1.org3.example.com not found.
7c129154a34a
3746b3295e48
d2cdb7e80c20
Untagged: dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab:latest
Deleted: sha256:af423f72155affe6f12819384004ffdbf3506274458e85ace79b85afa9f2edaf
Deleted: sha256:b3fbcd50f54c60d9454612a3ed2a01b0c4d060b27113fc1a9d1289647d43d0fe
Deleted: sha256:71212a99a5c510e8d4e06d998c9238f8aeab0d39b43585c0f592bcb783212115
Deleted: sha256:6a155ef7756a3361c3c549a4bb9bb8b9138ef53ebfada38d65dc00d874ebc5b6
Untagged: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9:latest
Deleted: sha256:c4c8845cab7101ee6a4456ee544c4a6599c42bbca545b11045d6b47c1223f205
Deleted: sha256:f2f179f4758793728780f909833f710c71f40e77303bd64eb910d572a641c66b
Deleted: sha256:03f9cd5e163dc2fae818d7864f8f068330eb7e0b0709a34d40dfcf0e40bd5d43
Deleted: sha256:8747af4513550fd8f0f6cfd22c61fd531b073a1a733d02ff6e3fb97fb6def027
Untagged: dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b:latest
Deleted: sha256:2bffc21709916a8d9bd1c20a65134ac3ca31ef5cc6e1282cea3b6be28d295acb
Deleted: sha256:7cf57b3452456b8da30c08d92d0c054fe32b2c91cd047dc8075706af2c14dc0d
Deleted: sha256:6e5b8c88c9d03c7d776953ee8c1b638d02a60438130c9d174b99455bc43d07b8
Deleted: sha256:b9eee4e0944c3b35fec12aa4bb5624d02825ab12e71d8a6a73e3de9702831382

References

上一篇 下一篇

猜你喜欢

热点阅读