5 minutes to Install Hyperledger Fabric v2.4.4 (and 1.x LTS) on Ubuntu 20.04 DigitalOcean


(Updated for Fabric 2.4.4 and Ubuntu 20.04, easily work with v2.2.3 LTS and v1.4.12 LTS too, still less than 3 mins to read, 5 mins to install! But try not to use the $5 1GB RAM instance with 2.3.x, you might run out of memory when starting the sample network, use the $10 2GB RAM one.)

Yes, It can be done, in 5 mins or so. So I won’t waste too much time to explain these to you. Just get a basic Ubuntu 20.04 Droplet from DigitalOcean, or use my link (Discount code for newbies, I get some free referral credits too) to sign up. Then run the following steps.

For Chinese version of this article, click here. 点击这里即可查看本文的中文版。

Check out my other articles on just running Hyperledger Composer (no longer supported) and Hyperledger Explorer. We aim to publish a full set of these guides on how to play around with Hyperledger technologies. I am a big fan of Brave browser, if you are into blockchain and crypto, should try it, make a little crypto from your regular web browsing.

Reminder about Fabric LTS. Fabric Long-term support releases might be much shorter than what you are used to with Ubuntu LTS of 5 years. v.1.4.x LTS “ended” support in April 2021 after 2.5 years or so (first released in Jan 2019). Having to possibly rebuild something every few years might be challenging for system designs.

Step 1 – For new Droplets, always set the locale (choose en_US.UTF-8 if in doubt) and do apt update/upgrade.sudo dpkg-reconfigure locales
sudo apt-get update && sudo apt-get upgrade

Step 2 – Setup a new user, it’s good practice not to use root to install these.sudo adduser dora
sudo usermod -aG sudo dora#Switch to the newly created user
su – dora

Step 3.- Set up the Prerequisites, logout and log back in as dora.sudo apt-get install curl git docker.io docker-compose nodejs npm python#Updating npm to 5.6.0
sudo npm install npm@5.6.0 -g#Setting up docker configuration
sudo usermod -a -G docker $USER
sudo systemctl start docker
sudo systemctl enable docker#Installing golang
wget https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz
tar -xzvf go1.13.6.linux-amd64.tar.gz
sudo mv go/ /usr/local#edit gopath in .bashrc
pico ~/.bashrc#(add these 2 lines to end of .bashrc file)
export GOPATH=/usr/local/go
export PATH=$PATH:$GOPATH/bin#exit and log back in as dora
exit
su – dora

Step 4.- This is the magic step to setup all the images needed for Hyperledger Fabric v2.3.2.# For latest version, just leave the version number out. That’s 2.4.4curl -sSL http://bit.ly/2ysbOFE | bash -s# If for any reason you want 2.3.2 LTS, can run this instead.curl -sSL https://bit.ly/2ysbOFE | bash -s 2.3.2# for 2.2.3 LTS, can run this instead.curl -sSL http://bit.ly/2ysbOFE | bash -s 2.2.3# for 1.4.12 LTS, can run this instead.curl -sSL http://bit.ly/2ysbOFE | bash -s 1.4.12

That’s it. You have done it. (If you needed previous version of Fabric, just type 1.4.12 or other release number in the above command. Or if you leave it blank, it will try to install the latest version.)

“Now what?” You might ask… You can try to build and run your first Hyperledger Fabric network. Files are already there. Change into the right directory and then run the generate and up command.cd fabricsamples/testnetwork./network.sh up

You will see the docker container list message when it is up and running.CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES59248236cd9f hyperledger/fabric-peer:latest “peer node start” 3 seconds ago Up Less than a second 0.0.0.0:7051->7051/tcp peer0.org1.example.comce8ecdf6435c hyperledger/fabric-orderer:latest “orderer” 3 seconds ago Up Less than a second 0.0.0.0:7050->7050/tcp orderer.example.com89bcf9a08111 hyperledger/fabric-peer:latest “peer node start” 3 seconds ago Up Less than a second 7051/tcp, 0.0.0.0:9051->9051/tcp peer0.org2.example.com

To check that everything is up and running, check with docker.docker ps -a

To stop your network, run the following../network.sh down

That’s it. Will write more about Chaincode next time.

Reminder: Check out my other articles on just running Hyperledger Composer (no longer supported) and Hyperledger Explorer. We aim to publish a full set of these guides on how to play around with Hyperledger technologies. I am a big fan of Brave browser, if you are into blockchain and crypto, should try it, make a little crypto from your regular web browsing.

For Chinese version of this article, click here. 点击这里即可查看本文的中文版。


There are a few good books on Amazon on Hyperledger Fabric (affiliate links below)

  1. Hands-On Smart Contract Development with Hyperledger Fabric V2: Building Enterprise Blockchain Applications 1st Edition
  2. Blockchain with Hyperledger Fabric: Build decentralized applications using Hyperledger Fabric 2, 2nd Edition 2nd ed. Edition
  3. Programming Hyperledger Fabric: Creating Enterprise Blockchain Applications
  4. Blockchain Development with Hyperledger: Build decentralized applications with Hyperledger Fabric and Composer
  5. Hyperledger Cookbook: Over 40 recipes implementing the latest Hyperledger blockchain frameworks and tools 1st Edition, Kindle Edition