Jeff Flowers / 27 February 2017 / Tutorials / 4898

Installation process:

The overview of the steps that are involved are as follows.

  • Ubuntu 16.04 LTS

  • Docker

  • Node.JS and NPM

  • GO Language

  • Hyperledger Fabric 0.6

Motivation:

Recently I attended a Hyperledger event in San Francisco.  It was at this meeting that many agreed documentation and the creation of new materials was needed.  Talking to people, I realized that a number of potential developers might be otherwise excluded from experimenting with this tool simply due to the complexity of installing these tools on their workstations. The goal of this tutorial is to get a person up and running in the shortest amount of time in a no frills Ubuntu environment.  I hope you enjoy.    

Pre-Requisites:

This tutorial will install Hyperledger Fabric v0.6 on a fresh Ubuntu install.  Before you proceed, some 'materials' are needed.  This will require

  • A fast Internet connection, as there are a number of 'large'ish' downloads

  • ~3 hours, or so (really depends on a number of factors, and I'm assuming that you are beginning at a completely clean slate)

  • 1 liter of cola

Ubuntu 16.04 LTS:

If possible, create either a new virtual machine (VM) or install on a fresh hard drive. This will limit potential installation conflicts between softwares.

Ubuntu 16.04 Desktop can be procured from:

Installation help can be found in a number of online tutorials, and is omitted from this document.  Help can  be found:

Once you have a clean copy of Ubuntu 16.04 installed and running, it is best to immediately update the operating system (OS).  To perform this operation, we need to open a terminal window.  In the upper left hand of your screen, click on the 'Search' icon:

1 Search

And search for "terminal", as shown:

2 Terminal

This will launch terminal and you can access the shell directly.  It is best to pin this directly on your launcher by right clicking the terminal icon and locking it down. 

Before proceeding, make certain that your computer is connected to your network and can see the Internet correctly.

In the terminal type:

>sudo apt-get update && sudo apt-get upgrade -y <enter>

Enter your administrator password if requested.

This will begin the updating of your packages as well as the upgrading of any that are required of the system.  After this process has completed it is recommended to update any link that may have been broken.  To do this, enter in the terminal:

>sudo ldconfig <enter>

Your copy of Ubuntu is now fully up to date and ready for docker installation.

Docker:

References:

Docker allows for rapid deployment of software within a fully containerized environment, containing a complete file system and all necessary dependencies, libraries, and supporting softwares.

To install, we need to make certain to have cURL and supporing tools installed on our system.  In terminal type:

>sudo apt-get install -y linux-image-4.4.0-51-generic <enter>

>sudo apt-get install -y linux-image-extra-4.4.0-51-generic <enter>

>sudo apt-get install -y linux-image-extra-virtual <enter>

>sudo apt-get update && sudo apt-get -y upgrade <enter>

>sudo ldconfig <enter>

The necessary dependencies and packages should be installed on your computer, allowing for the installation of docker for the first time.  We will be installing via a repository.  In order to perform this, we will need ensure that we add the repository to our system.  In a terminal window type:

>sudo apt-get install -y apt-transport-https ca-certificates <enter>

Add the necessary GPG key to our system.

>curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add - <enter>

Check that the key ID is correct:

>sudo apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D <enter>

We can now setup the stable repository containing Docker.

>sudo apt-get install -y software-properties-common <enter>

>sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main" <enter>

It is now possible to install Docker:

>sudo apt-get update <enter>

>sudo apt-get install -y docker-engine <enter>

>sudo apt-get install -y docker-compose <enter>

We can verify the installation process:

>sudo docker run hello-world <enter>

Docker will pull and then execute the necessary image.

Screenshot from 2017 02 06 04 48 35

Docker is now installed and is able to be used by a root level user. In order to allow users other than root to use, a new group will be created.

>sudo groupadd docker <enter>

>sudo usermod -aG docker $USER <enter>

The software now needs to be configured for auto start. 

>sudo systemctl enable docker <enter>

Screenshot from 2017 02 06 04 53 21

It is probably a good idea by now to reboot the system, to ensure that all processes have a chance to start.

>sudo reboot <enter>

After reboot, you should have Docker running and ready for use.

Node.JS and NPM:

References:

Prior to installing Hyperledger, NPM (and node.js) are either required and/or highly recommended.

>sudo apt-get install -y nodejs <enter>

>sudo apt-get install -y nodejs-legacy <enter>

NOTE:  The legacy version is needed at this time, but may change in the future.

>sudo apt-get install -y npm <enter>

Check to see if NPM has been properly installed:

>npm --version <enter>

You should see a release >3.5 if the software was installed properly.

Additional packages that are required:

>sudo npm install -g nodemon node-sass <enter>

Truthfully, we are doing a lot 'wrong' in the above statement; however, this is the most direct route at installing these for our use case.

GO Language:

References:

Prior to installing Hyperledger, the GO Language is needed.

>sudo apt-get install -y golang <enter>

Verify installation:

>go version <enter>

Check if a version 1.6 and above has been returned.

Hyperledger Fabric 0.6:

References:

We will be installing the v.06 as 1.0 as of right now is still under active development.  The software will be installed in a local directory.

>mkdir fabricv06 <enter>

>cd fabricv06 <enter>

Screenshot from 2017 02 06 05 11 55

We are able to now install the software within this local directory.

For the next part, if you are denied due to permissions then  reboot to fix.

>curl -o Dockerfile https://raw.githubusercontent.com/hyperledger/fabric/master/examples/sdk/node/Dockerfile <enter>

Prior to issuing the actual docker command, there needs to be one small configuration change to compensate for potential network issues:

>npm config set registry http://registry.npmjs.org/

You may or may not require the above command.  We can now begin the process:

>docker build -t hyperledger/fabric-starter-kit:latest . <enter>

Screenshot from 2017 02 06 06 13 11

You may need to manually install hfc on your system:

>npm install hfc <enter>

The necessary software has now been installed and can be run.  To start, type:

>docker-compose up -d <enter>

This will start the fabric network environment in the background and three docker containers will begin.  In order to see what is happening, type:

>docker ps <enter>

Screenshot from 2017 02 06 08 04 14

The three docker containers can be inspected.

Start a new terminal session within the container labeled, "starter":

>docker exec -it starter /bin/bash <enter>

It should be noted that you are root and care needs to be taken.

Screenshot from 2017 02 06 08 15 24

Next up, actually doing something interesting...

Add comment


Security code Refresh

Talk to Us!

Get a quote, give us suggestions, or send us a hello :)

816.983.6923

San Mateo, California

PGP: 20AE A7E7 6CA8 F81B 4FB1 C942 BA34 7830 1DEB 320E