安装 ssh

  1. sudo apt-get update
  2. sudo apt-get install ssh

安装 Go

  1. 下载

Go源码下载 选择对应的平台下载。

  1. 准备

在下载的位置打开 terminal 。

  1. 安装

sudo tar -zxvf goxxxxx.tar.gz -C /usr/local, 建议 /usr/local 位置安装。

  1. 配置

sudo gedit /etc/profile, 追加以下配置到环境变量。

export GOROOT=/usr/local/go
export GOPATH=~/code/go

save and exit.

  1. 测试

source /etc/profile 立即适应新环境

输入 go version,成功查看版本信息杂表示配置成功。

安装 Docker-CE

  1. 前置工作

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-get update

  1. 安装 Docker

sudo apt-get install docker-ce

  1. 将当前用户添加到 Docker Group(支持不使用 sudo 执行 docker 命令)

sudo usermod -aG docker bey

  1. 测试

docker run hello-world,正确输出结果如下:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

安装 Docker-Compose

  1. 下载最先版本的 Docker Compose

sudo curl -L https://github.com/docker/compose/releases/download/1.24.0-rc1/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose

  1. 给二进制文件添加执行权

sudo chmod +x /usr/local/bin/docker-compose

  1. 查看版本

docker-compose -v

下载 fabric 及其镜像

go get

  1. 可以的话,直接 go get 获取 go get github.com/hyperledger/fabric,如果 go get 命令无法执行,再试试 Git

git clone

  1. 创建目录 mkdir -p $GOPATH/src/github.com/hyperledger/,进入目录 cd $GOPATH/src/github.com/hyperledger/
  2. 克隆 fabric git clone https://github.com/hyperledger/fabric.git,下载完成后,进入 fabric 文件夹
  3. 切换 1.4 版本(可选)

git checkout v1.4.0

生成 fabric-tools

  1. 下载 fabric-sample

cd $GOPATH/src/github.com/hyperledger/fabric/scripts

./bootstrap.sh

该脚本运行时间较长,主要是在下载 fabrice 各个组件的 docker 镜像

  1. 将 fabric-tools 复制到 usr/local/bin 目录

cd $GOPATH/src/github.com/hyperledger/fabric/scripts/fabric-samples/bin

sudo cp -r . /usr/local/bin

这样就可以到处使用 fabric-tools 了。

测试

cd $GOPATH/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network

./byfn.sh down

./byfn.sh up

看到如下信息表示部署成功,恭喜!

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


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

youbei
318 声望70 粉丝

引用和评论

0 条评论