您的位置:首页 > 其它

Ubuntn 16.04 部署Hyperledger Fabric(一)环境搭建

2019-02-27 17:51 375 查看

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) <docker@docker.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目录下

root@ubuntu:~# cd /usr/local
root@ubuntu:/usr/local#
root@ubuntu:/usr/local# wget https://studygolang.com/dl/golang/go1.11.linux-amd64.tar.gz
root@ubuntu:/usr/local# tar -xzvf go1.11.linux-amd64.tar.gz
解压后如下所示
root@ubuntu:/usr/local# ls
bin  games  go1.11.linux-amd64.tar.gz  lib  sbin   src
etc  go     include                    man  share
2、添加环境变量

在根目录下新建go文件夹

root@ubuntu:~# mkdir go
root@ubuntu:~# ls
go  go1.11.linux-amd64.tar.gz

添加环境变量

root@ubuntu:~# 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

保存后退出,让更改生效

root@ubuntu:~# source /etc/profile

查看安装版本

root@ubuntu:~# go version
go version go1.11 linux/amd64

四、安装node.js

需要8.9.x及以上版本

root@ubuntu:~# curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
root@ubuntu:~# sudo apt-get install -y nodejs
root@ubuntu:~# node -v
v8.15.1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: