Step By Step Guide to Install Hyperledger Fabric in Ubuntu

Step By Step Guide to Install Hyperledger Fabric in Ubuntu
Step By Step Guide to Install Hyperledger Fabric in Ubuntu
Step By Step Guide to Install Hyperledger Fabric in Ubuntu
Step By Step Guide to Install Hyperledger Fabric in Ubuntu
Step By Step Guide to Install Hyperledger Fabric in Ubuntu
Step By Step Guide to Install HyperLedger in Ubuntu
Hyperledger Fabirc Techaorha Solutions Private Limited , Mumbai

Before understanding how Install Hyperledger Fabric in Ubuntu  , please try to understand what exactly is block chain and what are the prerequisite required.

What is BlockChain and Hyperledger Fabric

Blockchain is finally making rounds around the globe. Initially started with Bitcoin , followed by many crypto currencies often refer as altcoin. Many people still believes that blockchain is all about Bitcoin and currency.

But Block Chain has many other applications and it can bring decentralization and transparency in every application or service we use.

Many organization and understood the importance of BlockChain and supporting platforms were launched to implement blockchain applications. Hyper Ledger Fabric is the a platform to developed and deploy Block Chain application/smart contract in Permission-ed network without requiring any sort of Crypto Currencies.

Techaorha Team in India (Mumbai) helps corporate and government to implement block chain application in their existing application make it more secure and transparent.

To Install Hyperledger Fabric in Ubuntu following componenets are required. Here is list. Steps required to install other components is detailed below that

  1. Curl
  2. Python
  3. Docker – Make sure you have made it accessible without sudo user and restart your system.
  4. Docker Compose
  5. Go Lang
  6. Node Js

Install Dependencies to Install Hyperledger Fabric in Ubuntu

Hyperledger requires some package to run the network, You must installing following dependencies to get started.

curl to Install Hyperledger Fabric in Ubuntu. INstall curl using following commands in Ubuntu

# command to install curl in ubuntu

sudo apt-get install curl

Installing Python  to Install Hyperledger Fabric in Ubuntu

Python is require for running hyperledger. Below command will install python 2.7 , which is the required version of hyper ledger.

# Command to install python

sudo apt-get install python

Installing Docker to Install Hyperledger Fabric in Ubuntu

Hyperledger requires docker 17.06.2-ce or greater. So if you install docker from ubuntu packages it may not work as required.

Follow the below commands to install Docker in Ubuntu for HyperLedger.

#update the package index with the following command

sudo apt-get update

#install packages to help wiht Docker Installation in Ubuntu

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

# Add docker gpg key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

# Verify the key in Ubuntu with Following Command

sudo apt-key fingerprint 0EBFCD88

#add repository to Ubuntu System with following command to Install Docker for Hyper ledger

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

#again update the packages

sudo apt-get update

#install the specific version of Docker for Hyperledger installation.

sudo apt-get install docker-ce=18.03.0~ce-0~ubuntu

#thanks

Installing Docker Compose to Install Hyperledger Fabric in Ubuntu

# download 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

#Apply executable to the binary

sudo chmod +x /usr/local/bin/docker-compose

#check docker composeversion

docker-compose –version

Installing Go-Lang  to Install Hyperledger Fabric in Ubuntu

GO lang is high level language developed by Google. Many applications are written in Go-Language. Go-Lang is required to program logic and smart contracts in Hyperledger

Follow below step to install go-lang in Ubuntu

#Download go-lang tar file using curl with the help of below commands

curl -O https://storage.googleapis.com/golang/go1.9.3.linux-amd64.tar.gz

#verify the code is from authentic source using below command

sha256sum go1.9.3.linux-amd64.tar.gz

#Extract the tar file in any folder

tar -xvf go1.9.3.linux-amd64.tar.gz

#move the go directory to usr/local using the following command

sudo mv go /usr/local

#open profile using below command

sudo vim ~/.profile

#following lines to ~/.profile file

export GOPATH=$HOME/go

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

#reload the file using following command

source ~/.profile #thanks.

Installing NodeJs  to Install Hyperledger Fabric in Ubuntu

Node Js  is script based programming language. NodeJs is required by Hyperledger fabric to program logic and write contracts. This can also be used to developed front-end with the help of angularjs framework.

For Hyper Ledger NodeJs version are limited. Hyperledger fabric does not support NodeJs 9.x and its requires NodeJs above 8.9.x , so here you see option are very limited and the best to to install node js is via source code.

Follow below steps to install hyperleger one by one.

#update ubuntu package

sudo apt-get update

#install build essentials

sudo apt-get install build-essential openssl libssl-dev pkg-config

# change to source directory

cd /usr/local/src #create node directory sudo mkdir node

#enter into directory

cd node

#download node js version 8.9.3 using following command

sudo wget https://nodejs.org/dist/v8.9.3/node-v8.9.3.tar.gz

#Extract the tar file

sudo tar zxvf node-v8.9.3.tar.gz

#change to extracted nodejs directory

cd node-v8.9.3

#Configure the Directory

sudo ./configure

# Run Make

sudo make

#Final Installation

sudo make install

#don’t forget to check the version using following commands

node –version

npm –version

$thanks

Download the fabric example and make the files readable. Make sure you navigate to the directory where you want to install the fabric example

#download fabric example

curl -sSL http://bit.ly/2ysbOFE | bash -s 1.2.0-rc1

Testing. To make sure everything is install as required. Lets run and create your first network on HyperLedger Fabric

Generate the Genesis block of Your Network

cd fabric-samples/first-network

sudo ./byfn.sh generate

Start Your Network

#Start Your Network

sudo ./byfn.sh up

If every things goes well , stop your network

sudo ./byfn.sh down

Thanks for Reading till end. Hope the information provided above is very helpful to you.

If you want any help you can always contact us over here.  Techaorha is always ready to take any project or challenges in block chain technology.