Installing Hyperledger Fabric v2.3 in Ubuntu — a simple guide

Saif
2 min readMay 24, 2021

Please note that this tutorial is more of a “cheat-sheet” rather than a walkthrough of all the commands!

Installing the prerequisites

We need to install:

  • Docker
  • Docker-Compose
  • Golang

Installing Docker

Please paste the commands below in your terminal

sudo apt updatesudo apt install apt-transport-https ca-certificates curl software-properties-commoncurl -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 updatesudo apt install docker-ce

The above commands will install docker.

Executing the Docker Command Without Sudo (Optional):

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

Installing 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-composesudo chmod +x /usr/local/bin/docker-compose

Now, you should exit the terminal and open a new one. To confirm the installations:

docker version

You should see version 20.10.6 installed.

Similarly execute:

docker-compose version

You should see version 1.21.2 installed.

Installing Golang

In your terminal paste in the below commands:

curl -O https://dl.google.com/go/go1.16.4.linux-amd64.tar.gztar xvf go1.16.4.linux-amd64.tar.gzsudo chown -R root:root ./gosudo mv go /usr/local

Now, you need to export gopath in your profile.

nano ~/.profile

The above command will open the profile in nano text editor. Paste the below path:

export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

To confirm the installation, execute:

go version

You should see version 1.16.4 installed

Installing Hyperledger fabric v2.3

From your terminal type in:

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

The above commands will download all the fabric binaries and sample networks, chaincodes.

You should be able to see fabric-samples directory created after the installation is successful.

To verify everything is running fine, execute:

cd fabric-samples/test-network./network.sh up createChannel -ca -c mychannel -s couchdbdocker ps
List of containers running

If you are able to see the peers, orderer, couchdb and cli containers running then our installation is successful.

Clean up

./network.sh downdocker volume prunedocker network prune

Hope this tutorial helps you.

--

--