LoginSignup
0
0

More than 5 years have passed since last update.

AWS EC2でHyperledger Fabricを動かす(2.Fabric前提条件の準備)

Posted at

AWSにUbuntuをセットアップし、FabricをDockerで起動してみたいと思います。

前回は、AWS EC2を用意するところまででした。
https://qiita.com/tmikada/items/a1f22fd5c61c2de71d19

今回は、Fabric導入のための前提条件を準備していきます。

必要なものはこちら

  • curl
  • docker 17.06.2-ce or greater
  • docker-compose 1.14.0 or greater
  • go 1.9.x
  • node.js 6.9.x or greater (7.xは現時点でサポート対象外)
  • npm
  • python 2.7

参照: http://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html

順番に導入していきます。

curl

インストール済み

$ curl --version
curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets 

docker

手順: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-using-the-repository

$ sudo apt-get update
$ sudo apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
     software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
$ 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

$ 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
$ apt-cache madison docker-ce

$ docker --version
Docker version 17.12.0-ce, build c97c6d6

docker-compose

手順: https://docs.docker.com/compose/install/#install-compose

$ sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 1.18.0, build 8dd22a9

go

手順: https://github.com/golang/go/wiki/Ubuntu

$ sudo apt-get install golang-go
$ go version
go version go1.6.2 linux/amd64

# バージョン古いため、新しいのを入れる

$ sudo add-apt-repository ppa:gophers/archive
$ sudo apt update
$ sudo apt-get install golang-1.9-go
$ go version
go version go1.6.2 linux/amd64

# 変わってない。。。
# 手順をよく見ると、1.9はこちらにあるらしい
$ /usr/lib/go-1.9/bin/go version
go version go1.9.2 linux/amd64

# パスを変更します
$ cd /usr/bin/
$ sudo rm go
$ sudo ln -s ../lib/go-1.9/bin/go
$ go version
go version go1.9.2 linux/amd64

GOPATHを設定します

$ mkdir ~/go
$ vi ~/.bashrc

# 以下の2行を追記
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

$ source ~/.bashrc
$ echo $GOPATH
/home/ubuntu/go

node.js, npm

nodeのバージョン管理は、nを使うことにしてみます
手順: https://qiita.com/seibe/items/36cef7df85fe2cefa3ea

バージョンの組み合わせは
https://nodejs.org/ja/download/releases/
を参照し、nodejs 6.9.5, npm 3.10.10 を選択

$ sudo apt-get install nodejs npm
$ nodejs --version
v4.2.6
$ npm --version
3.5.2

# nをインストールしてnodeの新しいバージョンを導入する
$ npm cache clean
$ sudo npm install -g n
$ n --version
2.1.7

$ sudo n 6.9.5
$ node --version
v6.9.5

# 古いnodejsはまぎらわしいため削除しておく
$ sudo apt-get purge nodejs

# バージョン指定してnpmをインストール
$ sudo npm install -g npm@3.10.10
$ npm --version
3.10.10

Python

2.7がインストールされていました

$ python --version
Python 2.7.12



ここまでで、やっと前提条件の準備が完了です。。。
次回はFabricを動かすところまで書くつもりです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0