Hyperledger之用谷歌云配置Fabric1.4环境

谷歌云系统配置

如下图所示:选择ubuntu系统进行配置,选择新建实例,名称随便取,地区尽量选择香港,在拉取镜像时比较快,类型选择1个vCPU 3.75G足够。
选择新建实例,名称随便取,地区尽量选择香港,在拉取镜像时比较快,类型选择1个vCPU 3.75G足够
选择永久性磁盘10GB
选择永久性磁盘10GB

Fabric环境配置

首先进行docker安装

  1. 执行以下命令自动安装:
sudo wget -qO- https://get.docker.com/ | bash
  1. 如果上面出错可执行以下命令:
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
  1. 安装docker-compose命令
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

安装git

命令如下:

apt-get update
apt-get install git

安装Go语言环境

命令如下:

1.安装命令:wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
解压命令,执行tar解压到/usr/loacl目录下(官方推荐):tar -C /usr/local -zxvf  go1.11.5.linux-amd64.tar.gz

2.5. 添加/usr/loacl/go/bin目录到PATH变量中。添加到/etc/profile 或$HOME/.profile都可以,本人习惯用vim,没有的话可以用命令sudo apt-get install vim安装一个。
打开 vim /etc/profile在最后一行添加

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

保存退出后source一下(vim 的使用方法可以自己搜索一下)source /etc/profile

下载Node.js

前往Node.js选择对应版本下载,使用如下命令:

$ wget https://npm.taobao.org/mirrors/node/v9.9.0/node-v9.9.0.tar.gz

解压

$ tar -C /usr/local -xzf node-v9.9.0.tar.gz

配置Fabric环境

1.下载Fabric源码

$ mkdir -p ~/go/src/github.com/hyperledger 
$ cd ~/go/src/github.com/hyperledger 
$ git clone https://github.com/hyperledger/fabric.git

2使用命令下载特定于平台的二进制文件

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

或者使用:

curl -sSL https://goo.gl/6wtTN5 | bash -s 1.4.0

一旦运行命令,它将在bin目录下下载各种工具,例如cryptogen,configtxgen等。
3.进入Bin文件目录设置cryptogen,configtxgen环境:

export PATH=${PWD}/../bin:${PWD}:$PATH

4.进入Fabric-sample/first-network测试环境是否搭建成功
执行./byfn.sh up命令日志如下:

Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n]
proceeding ...
Creating network "net_byfn" with the default driver
Creating peer0.org1.example.com
Creating peer1.org1.example.com
Creating peer0.org2.example.com
Creating orderer.example.com
Creating peer1.org2.example.com
Creating cli

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

Channel name : mychannel
Creating channel...

看到如上日志说明环境搭建成功。
执行./byfn.sh down关闭和清理镜像
在这里插入图片描述
未完,待续。。。。。。。

猜你喜欢

转载自blog.csdn.net/weixin_43318506/article/details/106235189