Hyperledger Fabric is a blockchain framework implementation that works as a foundation for developing applications with a modular architecture. Normally, Hyperledger Fabric is quite difficult to install. And even though the time you invest will be paid off with a powerful tool, you might want an easier method for installing it.

The good news is that there is an easier method of deploying Hyperledger Fabric. That method comes by way of Docker. And because all of the pieces are open source, there’s little to no cost here.

I’m going to walk you through the process of installing Hyperledger Fabric v 1.4.4 on Ubuntu Server 18.04, via the Docker container engine. You’ll use the command line for the entire method, so be prepared to type a bit. 

This tutorial assumes you already have an instance of Ubuntu Server 18.04 up and running. You will also need an account with sudo rights.

With that said, let’s deploy this container so you can start developing blockchain applications.

Update and Upgrade

Before we get into the deployment, let’s update and upgrade your Ubuntu server first. It’s important to know that, after upgrading the kernel, you’ll have to reboot the machine (so the updates will take effect).

In order to update and upgrade ubuntu, log into the server and issue the following two commands:

sudo apt-get update

sudo apt-get upgrade -y

Once you complete that, reboot your server (if necessary) and log back in. You’re now ready to start the installation/deployment process. You won’t even need to bring in your third-party outsourcing services to take care of this task.

Installing Docker Engine

The first thing you need to do is install the Docker engine. To do this, issue the command:

sudo apt-get install docker.io -y 

Once the installation finishes, start and enable the Docker engine with the commands:

sudo systemctl start docker
sudo systemctl enable docker

Next, you need to add your user to the Docker group. If you don’t do this, you’ll only be able to run the Docker command with sudo, which can lead to security issues. To add your user to the Docker group, issue the command:

sudo usermod -aG docker $USER

In order for the change to take effect, you must log out and log back into your Ubuntu server. To verify your user has permission to use the docker engine, issue the command:

docker ps -a

You shouldn’t get any errors from the command. Instead, you’ll see no docker containers listed (Figure 1).

Deploying the Container

At this point, you are now ready to deploy the Hyperledger Fabric container. This task can be done with a single command. The command is:

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

You can define which version of the framework to deploy. For instance, if you want to deploy the beta version (2.0), you could issue the command:

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

Or if you wanted to deploy an older version, you could issue the command:

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

To find out what versions are available, check out the official Hyperledger Fabric release page.

You now need to build your first Hyperledger Framework network so the container can be deployed. To do this, change into the newly-created directory with the command:

cd ~/fabric-samples/first-network

Now generate the network with the command:

./byfn.sh generate

Finally, bring the network up with the command:

./byfn.sh up

The final command will take some time to complete. Once it finishes, you can verify it’s actually up and running by issuing the command:

docker ps -a

This time around (Figure 2), you should see the framework has been deployed.

Figure 2

The Hyperledger Framework has been successfully deployed.

Finally, you might want to add the download directory to your $PATH, so you don’t always have to type the full path to the download directory. To do this, issue the command:

export PATH=<path to download location>/bin:$PATH

Where path to download location is the full path to the directory (such as ~/fabric-samples). 

When you’re finished, you can bring down the network with the command (run from within the ~/fabric-samples/first-network directory):

./byfn.sh down

Just remember, if you need to work with the framework again, you’ll have to bring the network backup with the command:

./byfn.sh up

Time To Develop

At this point, you can now start developing your first application on your Hyperledger Framework network. To start on your Hyperledger Framework development path, you should read up on the official documentation before diving in.


Please enter your comment!
Please enter your name here