setup hyperledger fabric on windows 10





What is the Hyperledger fabric?
Hyperledger Fabric is a business blockchain framework hosted by the Linux Foundation intended as a foundation for developing blockchain applications or solutions with a modular architecture. Hyperledger Fabric allows components such as consensus and membership services to be plug-and-play.
( From Google Search Result )

Though documents say that hyper ledger fabric works on the windows, I can't find it running in well. I tried hard to run it but failed. But I found another way to run the hyper ledger on windows with Linux subsystem which has been officially available in windows 10.



(Video Guide )

Requirement

windows 10 Pro
Docker CE
PowerShell
Nodejs
Go 1.9

Basic Setup ( Step - 1 )

The first step to set up the hyperedge fabric on windows is to enable the Linux subsystem

1. Enable the Linux subsystem on your windows


Enable Linux SubSystem
Enable Linux SubSystem

2. Install your favourite Linux subsystem from the store ( i prefer ubuntu )


Add Ubuntu Linux Subsystem
Add Ubuntu Linux Subsystem

3. Install Docker
Install Docker
Install Docker

   ( Docker Requires Hyper-V to run so enable hyper-v )
   ( Afer installation reboot the system )

Configure Docker to work with Linux subsystem

Make the docker running
Start Docker
( Run the docker as Linux container)
Docker as Linux container
Docker as Linux container

If you get the not enough memory


Not Enough Memory error
Not Enough Memory error


error goto settings and change the settings to use fewer resources
( It will definitely start and if not then you have to add more ram to your system )


Update docker settings
Update docker settings


We need to expose the daemon to port 2375  in the setting.


Expose daemon to port 2375
Expose daemon to port 2375

Share the drive so we can mount that drive in our Linux subsystem to use it with the docker.


Share drive docker
Share drive docker


also, give them permission to drive to share


Share drive windows
Share drive windows



Setup the hyper ledger in the Linux subsystem


Now open the Linux subsystem and follow the steps


Ubuntu Linux subsystem
Ubuntu Linux subsystem

First of all check for the update

$ sudo apt-get update


update ubuntu
Update ubuntu


Install curl

$ sudo apt-get install curl


 Install Curl on ubuntu
Install Curl on ubuntu

we are going to use curl to fetch docker images from the server using the curl


install docker-compose to connect the docker we have installed on windows with the Linux subsystem
$ sudo apt install docker-compose

install node js and npm

$ sudo apt update
$ sudo apt install nodejs
$ sudo apt install npm


Now,
we have to mount the d drive to our Linux subsystem
There is a workaround for mounting /mnt/d to /d





if you drive has successfully mounted then you will be able to see the content of your drive in the ls command from the Linux subsystem.


Verify mounting of drive
Verify mounting of drive


Create a new folder in the drive which you want to use as your hyper ledger fabric workspace.
Create workspace
Create workspace

Move to the directory you have created and pull in the sample project from the GitHub there.

$ git clone https://github.com/hyperledger/fabric-samples.git

install the docker images of the hyper ledger fabric

curl -sSL https://goo.gl/byy2Qj | bash -s 1.0.5


You have successfully installed the hyper ledger fabric. You can test it using running any sample project provided there.

We will test using the First-network project

First of all, generate a sample network using

./byfn -m generate





Make the network up

./byfn -m up





Hope Find it useful,


If you need any help just comment. I will be happy to help

Comments