Ubuntn 16.04 部署Hyperledger Fabric(一)
阿新 • • 發佈:2018-12-20
Ubuntn 16.04 部署Hyperledger Fabric(一)
本教程依照官網文件部署https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html
部署環境為Ubuntn16.04,在root使用者下。
一、安裝cURL
如果之前沒有安裝curl,或者執行文件中的curl命令出錯時,則安裝最新版本curl工具,在命令列中輸入以下命令。
apt install curl
二、Docker 和Docker-compose
1 安裝Docker
參考官方文件https://docs.docker.com/install/linux/docker-ce/ubuntu/
1.1 解除安裝舊版本
舊版本的docker名稱為docker或者docker-engine,如果之前安裝過,那麼將其解除安裝。
$ sudo apt-get remove docker docker-engine docker.io
1.2安裝docker-CE(使用Repository安裝Docker)
1.2.1設定Repository
(1) 更新apt包索引
$ sudo apt-get update
(2) 安裝包以允許通過HTTPS使用儲存庫
$ sudo apt-get install \
apt-transport-https \
ca- certificates \
curl \
software-properties-common
(3) 新增Docker的官方GPG金鑰
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
通過檢視指紋的最後8個字元,驗證您現在擁有指紋9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88的金鑰
$ sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <[email protected].com>
sub 4096R/F273FCD8 2017-02-22
(4) 設定stable版本Repository
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
1.2.2 安裝docker-CE
(1) 更新apt包索引
$ sudo apt-get update
(2) 安裝最新版本的Docker-CE
$ sudo apt-get install docker-ce
檢視docker版本
docker --version
顯示如下
Docker version 18.09.0, build 4d60db4
(3)測試
$ sudo docker run hello-world
結果如下,docker安裝成功。
Status: Downloaded newer image for hello-world:latest
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/
2 安裝docker-compose
參考官方文件https://docs.docker.com/compose/install/
1、下載最新版本Docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2、應用可執行許可權
sudo chmod +x /usr/local/bin/docker-compose
3、測試
$ docker-compose --version
docker-compose version 1.23.1, build 1719ceb
三、安裝Go
需要1.11.x以上版本
1、下載
切換至/usr/local目錄下
[email protected]:~# cd /usr/local
[email protected]:/usr/local#
[email protected]:/usr/local# wget https://studygolang.com/dl/golang/go1.11.linux-amd64.tar.gz
[email protected]:/usr/local# tar -xzvf go1.11.linux-amd64.tar.gz
解壓後如下所示
[email protected]:/usr/local# ls
bin games go1.11.linux-amd64.tar.gz lib sbin src
etc go include man share
2、新增環境變數
在根目錄下新建go資料夾
[email protected]:~# mkdir go
[email protected]:~# ls
go go1.11.linux-amd64.tar.gz
新增環境變數
[email protected]:~# vim /etc/profile
在檔案末尾處新增以下文字
export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$HOME/go/bin
儲存後退出,讓更改生效
[email protected]:~# source /etc/profile
檢視安裝版本
[email protected]:~# go version
go version go1.11 linux/amd64
四、安裝node.js
需要8.9.x及以上版本
[email protected]:~# apt-get install nodejs
[email protected]:~# node -v
v8.10.0