5 minutes to Install Hyperledger Fabric v2.3.2 (and 2.2.3 & 1.4.12 LTS) on Ubuntu 20.04 DigitalOcean
(Updated for Fabric 2.3.2 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.
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.
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 email@example.com -g#Setting up docker configuration
sudo usermod -a -G docker $USER
sudo systemctl start docker
sudo systemctl enable docker#Installing golang
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 PATH=$PATH:$GOPATH/bin#exit and log back in as dora
su - dora
Step 4.- This is the magic step to setup all the images needed for Hyperledger Fabric v2.3.2.
curl -sSL https://bit.ly/2ysbOFE | bash -s 2.3.2# If for any reason you want 2.2.3 LTS, can run this instead.curl -sSL http://bit.ly/2ysbOFE | bash -s 2.2.3# If for any reason you want 1.4.12 LTS, can run this instead.curl -sSL http://bit.ly/2ysbOFE | bash -s 1.4.12# For latest version, just leave the version number out.curl -sSL http://bit.ly/2ysbOFE | bash -s
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 fabric-samples/test-network./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.
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.