3 easy steps to setup Hyperledger Fabric in Virtual Machine (VM) .

Madhavi Kulkarni
4 min readFeb 5, 2020


Hi All,

I am not a perfect writer but trying to share my knowledge by writing this post. As this is my first post, Kind apologies for the flaws.

Before we actually setup the fabric, we must know what are the pre-requisites to be installed in the VM.


  1. Docker & Docker-compose
  2. Node
  3. Hyperledger Fabric

Steps for implementation:

Step 1: Docker & Docker-compose

Let us first start with the first step, docker and docker-compose installations.

First of all, you can check for the docker version by giving the command as

$ docker --version.

The version of the docker

If docker already exists, you can find the version else you have to install the docker in vm by executing command recommended in the VM.

then check for docker-compose version that gets installed along with the Docker. Command to check version of Docker-compose is :

$ docker-compose --version

Step 2: Installation of Node

Now download the Node of the specific version and install it.

  1. Enable the NodeSource repository by running the following curl :
  • curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

The command will add the NodeSource signing key to your system, create an apt sources repository file, install all necessary packages and refresh the apt cache.

2. If you need to install another version, for example 12.x, just change setup_10.x with setup_12.x

3. Once the NodeSource repository is enabled, install Node.js and npm by typing:

  • sudo apt install nodejs

The nodejs package contains both the node and npm binaries.

4. Verify that the Node.js and npm were successfully installed by printing their versions:

  • node --version
  • v10.16.3

You can also refer the below link to install the Node by following the steps mentioned for a specific version.


and check for the version of the node by giving command: $ node -v

Node version

Step 3: Fabric Setup

Once the pre-requisites are done, the main portion of the Fabric setup begins.

First of all select the version of the fabric that you want to setup. I will for now give the commands to install Fabric of version 1.4

If you want to install the Fabric of some other version, you can select the version from the below link and then setup.

To setup the Hyperledger fabric of version v 1.4, execute the below command:

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

The above command installs the fabric v1.4.4

This can be checked by giving following command after installation:

$ docker images

The output of above command is

Once the images are created, Hyperledger Fabric of that particular version is setup in the Vm.

Common challenges:

Command to change permissions for docker.sock is : $ sudo chmod -R 777 /var/run/docker.sock

This command helps in installing the docker images. Sometimes, we may get permission denied to /var/run/docker.sock file.

If you want to download the docker images of a specific version, delete the images and then run below command(Instead of 1.4.4, you can give 1.4.3 or as desired):

$ curl -sSL http://bit.ly/2ysbOFE | bash -s -- <fabric_version> <fabric-ca_version> <thirdparty_version>
$ curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.4 1.4.4 0.4.18

The command above downloads and executes a bash script that will download and extract all of the platform-specific binaries you will need to set up your network and place them into the cloned repo you created above. It retrieves the following platform-specific binaries:

  • configtxgen,
  • configtxlator,
  • cryptogen,
  • discover,
  • idemixgen
  • orderer,
  • peer, and
  • fabric-ca-client

and places them in the bin sub-directory of the current working directory.

Thank you, please leave your feedback and suggestions below.

Happy learning :)