Install and configure Hyperledger Fabric v1.4 in Ubuntu 18.04.3 LTS

Jay Chandran
Coinmonks
6 min readMay 15, 2020

--

The official documentation for Hyperledger Fabric v1.4 has prerequisites that are required for blockchain application development. This article lays out the step by step guide on how to install and configure the prerequisites on Ubuntu 18.04.3 LTS.

It is assumed that you have Ubuntu 18.04.3 LTS 64-bit version installed.

Photo by Matthew Henry from Burst

Prerequisites

  • cURL: latest version
  • Docker and Docker Compose: 17.06.2-ce or greater
  • Go: version 1.12.x
  • Node.js: version 8 (8.94 and higher) or version 10 (10.15.3 and higher)

cURL

Step 1. Update the package list

Output

jay@hlf-dev:~$ sudo apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists… Done
jay@hlf-dev:~$

Step 2. Install cURL

Step 2. Check curl version

Output

curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
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 HTTP2 UnixSockets HTTPS-proxy PSL

Docker

Step 1. Update the package list

Step 2. Install the required packages

Step 3. Add Docker’s official GPG key:

Step 4. Setup the Docker stable repository

Step 5. Update the package list

Step 6. Install the latest version of Docker engine

Step 7. Add user to Docker group

In order to run the docker commands without sudo, you need to add the current user to the docker group with the below command.

To confirm if the user is added to docker group, try the command

Output

jay adm cdrom sudo dip plugdev lpadmin sambashare docker

Step 8. Check Docker version

jay@hlf-dev:~$ docker --version
Docker version 19.03.8, build afacb8b7f0
jay@hlf-dev:~$

Step 9. Verify the Docker Engine

The below command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Install Docker Compose

Step 1. Download the latest version of the Docker Compose

Step 2. Apply executable permissions to the binary

Step 3. Check Docker Compose version

jay@hlf-dev:~$ docker-compose --version
docker-compose version 1.25.5, build 8a1c60f6
jay@hlf-dev:~$

Install Go

The recommend version of Go is version 1.12.x.

Step 1. Download the tar file

Step 2. Extract the tar file

Step 3. Move the go directory

Step 4. Update environment variables

We need to update environment variables i.e. PATH and GOPATH. For this the user’s profile needs to be updated.

Add the below in the .profile file.

Save the .profile file and load the updated environment variables.

Step 5. Check go version

jay@hlf-dev:~$ go version
go version go1.12.9 linux/amd64
jay@hlf-dev:~$

Install Node.js and NPM

If you will be developing applications for Hyperledger Fabric leveraging the Hyperledger Fabric SDK for Node.js, version 8 is supported from 8.9.4 and higher. Node.js version 10 is supported from 10.15.3 and higher.

We will be installing 10.x version. Installing Node.js will also installs NPM

Step 1. Install the Node.js v10.x repository

Step 2. Install nodejs

Step 3. Check node version

jay@hlf-dev:~$ node -v
v10.20.1
jay@hlf-dev:~$

Step 4. Check NPM version

jay@hlf-dev:~$ npm -v
6.14.4
jay@hlf-dev:~$

Install Hyperledger Samples, Binaries and Docker Images

Under Fabric 1.4.x releases, v 1.4.7 is the latest release and we will install this version.

Step 1. Before downloading the Fabric binaries, create a directory for e.g. hyperledger in your home path.

Step 2. Download Fabric v1.4.7

From the hyperledger directory (for e.g. /home/jay/hyperledger) run the below command. Please note, this will take quite sometime based on your internet speed.

Step 3. Update environment variable

Add the fabric bin path to the PATH variable. Please make sure to use the path where you have downloaded fabric binaries.

Save the .profile file and load the updated environment variables.

Testing the Hyperledger Fabric installation

Fabric comes with few fabric samples which can be used to test the fabric installation.

Step 1. Change directory to the first-network directory

Step 2. Use the script to bring up the network.

In case you are wondering, byfn stands for Build Your First Network. Refer here for further details.

Step 3. Verify the Docker containers

Step 4. Bring down the network

This concludes the steps required to setup Hyperledger Fabric v1.4 in Ubuntu 18.04.3 LTS.

Thank you for reading and I hope it was helpful! ☺️

--

--