Ubuntu 18 部署 Hyperledger Fabric 1.4

安裝 ssh

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

安裝 Go

  1. 下載

Go源碼下載 選擇對應的平臺下載。linux

  1. 準備

在下載的位置打開 terminal 。git

  1. 安裝

sudo tar -zxvf goxxxxx.tar.gz -C /usr/local, 建議 /usr/local 位置安裝。github

  1. 配置

sudo gedit /etc/profile, 追加如下配置到環境變量。golang

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

save and exit.docker

  1. 測試

source /etc/profile 當即適應新環境bootstrap

輸入 go version,成功查看版本信息雜表示配置成功。ubuntu

安裝 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 updatebash

  1. 安裝 Docker

sudo apt-get install docker-ceapp

  1. 將當前用戶添加到 Docker Group(支持不使用 sudo 執行 docker 命令)

sudo usermod -aG docker beyssh

  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 =========== 


 _____   _   _   ____   
| ____| | \ | | |  _ \  
|  _|   |  \| | | | | | 
| |___  | |\  | | |_| | 
|_____| |_| \_| |____/
相關文章
相關標籤/搜索