Install Hyperledger Fabric v2.2.x(LTS) or v2.3 on Ubuntu

·

2 min read

Install Hyperledger Fabric v2.2.x(LTS) or v2.3 on Ubuntu

This is an easy to follow installation guide for Hyperledger Fabric(HLF) on Ubuntu. The steps have been tested on Ubuntu 18.04 and 20.04. At the end of this tutorial, you should be able to install HLF.

Step 1: Install curl, git

sudo apt update
sudo apt-get install curl git

Step 2: Install Docker

sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-ce

The above command should install docker!

Executing the Docker Command Without Sudo (Optional):

sudo usermod -aG docker ${USER}
su - ${USER}
sudo usermod -aG docker username

Install Docker-compose

sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Now, you should exit the terminal and log back in. To confirm the installations check for the versions. Docker version should be 20.10.6 and Docker-compose should be 1.21.2.

docker version
docker-compose version

Step 3: Install Golang

curl -O https://dl.google.com/go/go1.16.4.linux-amd64.tar.gz
tar xvf go1.16.4.linux-amd64.tar.gz

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Now, you have to open your bashrc file and add two lines, at the end of the file:

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Step 4: Install Node.js (optional)

We will be installing node.js using nvm.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm list-remote
nvm install v14.17.0

Check the node.js version, it should be 14.17.0

node -v

Step5: Install Hyperledger Fabric

To install v2.2.3 LTS:

curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.2.3 1.5.0

To install latest production release

curl -sSL https://bit.ly/2ysbOFE | bash -s

That's all you have to do!

Now we need to check, if the installations were done properly. After you executed the curl command to install hyperledger fabric, you will see a fabric-samples repo in the same directory where you had executed the curl command.

Fabric-samples comes in with a sample test network, which we can run to verify our installation.

cd fabric-samples/test-network
./network.sh up createChannel -ca -c mychannel -s couchdb

The above command will create a channel(mychannel) with certificate Authorities and bring up couch-db as state database.

To confirm our installations, execute:

docker ps -a

You should be able to see the containers up and running.

image.png

Congratulations on installing Hyperledger Fabric. Fell free to comment, if you face any issues.