Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 视频教程 | 打赏(Donations) | About
知乎专栏多维度架构微信号 netkiller-ebook | QQ群:128659835 请注明“读者”

24.2. Ubuntu 环境安装 Hyperledger Fabric v1.1.0

24.2.1. 安装 Docker

Ubuntu apt 库中携带的 docker.io 版本过低,我们从官网安装Docker CE(社区版)取代他。

确保环境是干净的,卸载旧版本的 Docker

			
sudo apt-get remove docker docker-engine docker.io			
			
			

从官网安装新版本的 Docker

			
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

sudo apt-get update
sudo apt-get install docker-ce

sudo apt-get install python-pip
pip install docker-compose
			
			

启动 docker

			
neo@netkiller ~ % sudo systemctl start docker
neo@netkiller ~ % sudo systemctl status docker 
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-03-10 04:56:01 HST; 4s ago
     Docs: https://docs.docker.com
 Main PID: 27572 (dockerd)
    Tasks: 18
   Memory: 21.9M
      CPU: 578ms
   CGroup: /system.slice/docker.service
           ├─27572 /usr/bin/dockerd -H fd://
           └─27587 docker-containerd --config /var/run/docker/containerd/containerd.toml

Mar 10 04:56:00 netkiller dockerd[27572]: time="2018-03-10T04:56:00.020801698-10:00" level=warning msg="Your kernel does not support swap memory limit"
Mar 10 04:56:00 netkiller dockerd[27572]: time="2018-03-10T04:56:00.020948715-10:00" level=warning msg="Your kernel does not support cgroup rt period"
Mar 10 04:56:00 netkiller dockerd[27572]: time="2018-03-10T04:56:00.020991877-10:00" level=warning msg="Your kernel does not support cgroup rt runtime"
Mar 10 04:56:00 netkiller dockerd[27572]: time="2018-03-10T04:56:00.024334084-10:00" level=info msg="Loading containers: start."
Mar 10 04:56:00 netkiller dockerd[27572]: time="2018-03-10T04:56:00.786564515-10:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be use
Mar 10 04:56:01 netkiller dockerd[27572]: time="2018-03-10T04:56:01.243512581-10:00" level=info msg="Loading containers: done."
Mar 10 04:56:01 netkiller dockerd[27572]: time="2018-03-10T04:56:01.262158514-10:00" level=info msg="Docker daemon" commit=7390fc6 graphdriver(s)=btrfs version=17.12.1-ce
Mar 10 04:56:01 netkiller dockerd[27572]: time="2018-03-10T04:56:01.262329696-10:00" level=info msg="Daemon has completed initialization"
Mar 10 04:56:01 netkiller dockerd[27572]: time="2018-03-10T04:56:01.280874987-10:00" level=info msg="API listen on /var/run/docker.sock"
Mar 10 04:56:01 netkiller systemd[1]: Started Docker Application Container Engine.			
			
			

24.2.2. 安装 Hyperledger Fabric v1.1.0 Docker 镜像

			
sudo docker pull hyperledger/fabric-ca:x86_64-1.1.0
sudo docker pull hyperledger/fabric-peer:x86_64-1.1.0 
sudo docker pull hyperledger/fabric-orderer:x86_64-1.1.0 
sudo docker pull hyperledger/fabric-couchdb:x86_64-1.1.0 
sudo docker pull hyperledger/fabric-tools:x86_64-1.1.0

sudo docker tag hyperledger/fabric-ca:x86_64-1.1.0 hyperledger/fabric-ca 
sudo docker tag hyperledger/fabric-peer:x86_64-1.1.0 hyperledger/fabric-peer 
sudo docker tag hyperledger/fabric-orderer:x86_64-1.1.0 hyperledger/fabric-orderer 
sudo docker tag hyperledger/fabric-couchdb:x86_64-1.1.0 hyperledger/fabric-couchdb 
sudo docker tag hyperledger/fabric-tools:x86_64-1.1.0 hyperledger/fabric-tools
			
			

			
neo@netkiller ~ % sudo docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
hyperledger/fabric-couchdb   latest              380446aa57b6        2 weeks ago         1.5GB
hyperledger/fabric-couchdb   x86_64-1.1.0        380446aa57b6        2 weeks ago         1.5GB
hyperledger/fabric-tools     latest              322eaa2b8786        3 weeks ago         1.33GB
hyperledger/fabric-tools     x86_64-1.1.0        322eaa2b8786        3 weeks ago         1.33GB
hyperledger/fabric-orderer   latest              659d92c1be85        3 weeks ago         151MB
hyperledger/fabric-orderer   x86_64-1.1.0        659d92c1be85        3 weeks ago         151MB
hyperledger/fabric-peer      latest              28c7c07db540        3 weeks ago         154MB
hyperledger/fabric-peer      x86_64-1.1.0        28c7c07db540        3 weeks ago         154MB
hyperledger/fabric-ca        latest              fe3c9b6542cf        3 weeks ago         238MB
hyperledger/fabric-ca        x86_64-1.1.0        fe3c9b6542cf        3 weeks ago         238MB
			
			
			

24.2.3. docker-compose

			
neo@netkiller ~ % sudo apt install python3-pip
neo@netkiller ~ % pip3 install docker-compose
			
			

或者

			
neo@netkiller ~ % sudo curl -sL https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
neo@netkiller ~ % sudo chmod +x /usr/local/bin/docker-compose
neo@netkiller ~ % docker-compose --version
docker-compose version 1.19.0, build 9e633ef