Hyperledger Fabric

Install Hyperledger Fabric on Ubuntu 18.04.1 – Step by Step

Posted on Updated on

Installation of Hyperledger Fabric on Ubuntu is very straight forward and is a step-by-step process. We can majorly divide this whole process into two major parts: First we need to install all pre-requisites and then we proceed towards installation of Fabric itself.

Installing Prerequisites for Hyperledger Fabric:

  • CURL
  • GO Programming Language with setup of path variable
  • Docker & Docker Compose
  • Node.js Runtime & NPM
To install all these prerequisites run following commands in terminal window one by one, everything should go smooth.

sudo apt-get install curl
sudo apt-get install golang-go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install python
sudo apt-get install docker
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 $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo apt-get install docker-compose
sudo apt-get upgrade

Till now the environment is ready to install Hyperledger Fabric, Now we will download fabric samples. To do that run following commands in terminal one by one…

sudo curl -sSL https://goo.gl/6wtTN5 | sudo bash -s 1.1.0
sudo chmod 777 -R fabric-samples

Now go into first-network directory which is inside fabric-samples folder and then we will run generate script that will create certificates and keys for the entities on our first blockchain network. This will also create genesis block (first block on blockchain)

cd fabric-samples/first-network
sudo ./byfn.sh generate

Bring your first network up by running following command. byfn stands for “Build Your First Network”

sudo ./byfn.sh up

If everything works fine you should see start screen of fabric network. To bring network down following command is used.
sudo ./byfn.sh down