Hyperledger Fabric v1.1.0 macOS部署开发者环境并创建第一个Fabric网络

版权声明:本文为博主原创文章,转载请注明来自 http://blog.csdn.net/hello2mao https://blog.csdn.net/hello2mao/article/details/79618941

一、安装所需软件

1.1 安装curl

brew install curl

1.1 安装Docker

下载并安装Docker for Mac:Docker.dmg

1.2 安装Golang

1.安装go

brew install go

2.设置GOPATH

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

1.3 安装指定版本的Node.js和NPM

Node.js 9.x版本还不支持,需要安装 8.9.x

brew install node@8

安装指定版本的NPM

npm install npm@5.6.0 -g

1.4 参考

http://hyperledger-fabric.readthedocs.io/en/release-1.1/prereqs.html

二、创建Fabric网络

注:建议以下操作都在/Users目录下的某个子文件夹中

2.1 下载Platform-specific Binaries

参考:http://hyperledger-fabric.readthedocs.io/en/release-1.1/samples.html#download-platform-specific-binaries
注:官网的“curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0”命令可能被墙或者没反应,这里就直接用原始url了。

curl https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh |bash -s 1.1.0

添加环境变量:

export PATH=<path to download location>/bin:$PATH

2.2 下载Hyperledger Fabric Samples

git clone -b master https://github.com/hyperledger/fabric-samples.git

2.3 创建第一个Fabric网络

参考:http://hyperledger-fabric.readthedocs.io/en/release-1.1/build_network.html

# (1)进入samples
cd fabric-samples/first-network
# (2)生成必要文件
./byfn.sh -m generate
# (3)启动网络
./byfn.sh -m up

当你看到下面的文字的时候,说明启动成功:

===================== Query on peer1.org2 on channel 'mychannel' is successful =====================

========= All GOOD, BYFN execution completed ===========


 _____   _   _   ____
| ____| | \ | | |  _ \
|  _|   |  \| | | | | |
| |___  | |\  | | |_| |
|_____| |_| \_| |____/

最后关闭网络:

./byfn.sh -m down

三、参考

1.http://hyperledger-fabric.readthedocs.io/en/release-1.1/index.html
2.https://www.jianshu.com/p/8beb3a355f99
3.https://www.jianshu.com/p/8c67894ab3ef

猜你喜欢

转载自blog.csdn.net/hello2mao/article/details/79618941