How to install Hyperledger Fabric & Composer on a Ubuntu 16.04 VPS
#1
I've seen this question quite a bit and a lot of people were having trouble with the official documentation. So I've decided to make a tutorial (with images) to go over step-by-step on how to run your very own Hyperledger Fabric and the Composer Playground. First you will need a Linux VPS. For this tutorial, I will be using a DigitalOcean, but you can use any VPS provider that allows Linux (Linode, Vultr, etc). I will be using Ubuntu 16.04. Hyperledger Fabric isn't yet compatible with newer versions (18.04), so it's recommended to use 16.04.

Click Here For The YouTube Walkthrough

(There appears to be a misconception that you need a powerful server to run Fabric, but this is not the case. The cheapest option (1 vCPU, 1GB RAM) will be more than enough.)

Requirements:
Ubuntu 16.04 VPS
SSH keys
Putty or an In-browser terminal to your VPS

Step 1: SSH into your VPS via Putty or an In-Browser Terminal
[Image: attachment.php?aid=4]
Here we are with a blank terminal window. Now let's get started!

Step 2: Create Another User
Run:
Code:
sudo adduser playground
You will now be asked to create a password for this new user. After entering a password. You will be asked some general questions (Full Name, Room Number, etc.). These can be left blank if you'd like. Once, you've gone through that, you will be asked to confirm if the information is correct, type:
Code:
y
for yes. Your terminal window should now look like this:
[Image: attachment.php?aid=5]

Step 3: Grant "playground" User Sudo Rights
Now we need to grant this new user with sudo rights. To do this run:
Code:
sudo usermod -aG sudo playground
Don't worry if your terminal didn't send a response and just went to the next line. That's normal.

Step 4: Switch To "playground" User
Now let's run: 

Code:
su - playground


Your screen should now look like this:
[Image: attachment.php?aid=6]
Step 5: Downloading Fabric Composer Tools
Now it's time to start getting our tools installed. Thankfully, the Hyperledger Fabric team has put all of our required tools into an easy-to-run script. Let's download that script now by running:
Code:
curl -O https://hyperledger.github.io/composer/latest/prereqs-ubuntu.sh

Now to change permissions run:
Code:
chmod u+x prereqs-ubuntu.sh
Now to install the tooling run: (Note: this will take a few minutes)
Code:
./prereqs-ubuntu.sh

[Image: attachment.php?aid=7]

Step 6: Logout Then Login
You will now notice a message "Please logout then login before continuing." This isn't just a pre-cautionary suggestion, if you fail to follow this step you will run into some serious issues further on. Believe me, I've already tried skipping this step.

If you're using Putty, just exit the program and re-open it. .  You will need to log back into the "playground" user:
Code:
su - playground

 
Step 7: Installing Final NPM Packages
Alright! We're almost done. Now we need to install some final NPM packages.

Run: 
Code:
npm install -g composer-cli
Code:
npm install -g composer-rest-server
Code:
npm install -g generator-hyperledger-composer
Code:
npm install -g yo
Code:
npm install -g composer-playground


Step 8: Install Hyperledger Fabric
Now we've got all of our tools setup, it's time to install what we've all come here for.. Hyperledger Fabric.
Run:
Code:
mkdir ~/fabric-tools && cd ~/fabric-tools
Code:
curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
tar -xvf fabric-dev-servers.tar.gz
Code:
./downloadFabric.sh
Now your download will start:
[Image: attachment.php?aid=8]

You're done!
To start your playground server, run:
Code:
composer-playground

Now navigate to your server's IP address with port 8080. (Ex: 213.54.225.43:8080)
[Image: attachment.php?aid=9]


Attached Files Thumbnail(s)
                       
Reply
#2
Thanks!!!
Reply
#3
I met the problem like this, how to solve this kind of problem
playground@ubuntu:~$ ./prereqs-ubuntu.sh
Installing Hyperledger Composer prereqs for Ubuntu xenial
# Updating package lists
[sudo] password for playground:
gpg: keyring `/tmp/tmpz6hsrrim/secring.gpg' created
gpg: keyring `/tmp/tmpz6hsrrim/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
Error: retrieving gpg key timed out.
gpg: /tmp/tmpz6hsrrim/trustdb.gpg: trustdb created
gpg: key E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
Reply
#4
(07-10-2018, 12:24 PM)melotime Wrote: I met the problem like this, how to solve this kind of problem
playground@ubuntu:~$ ./prereqs-ubuntu.sh
Installing Hyperledger Composer prereqs for Ubuntu xenial
# Updating package lists
[sudo] password for playground:
gpg: keyring `/tmp/tmpz6hsrrim/secring.gpg' created
gpg: keyring `/tmp/tmpz6hsrrim/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
Error: retrieving gpg key timed out.
gpg: /tmp/tmpz6hsrrim/trustdb.gpg: trustdb created
gpg: key E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK

I have gotten this issue before and it was always due to a connection issue. Wait a few minutes and run the pre-reqs script again. If you got the same error, create another user and go through all the installation steps on the new user, as sometimes it will cache a bad gpg key on the old user.
Reply
#5
(07-10-2018, 05:41 PM)admin Wrote:
(07-10-2018, 12:24 PM)melotime Wrote: I met the problem like this, how to solve this kind of problem
playground@ubuntu:~$ ./prereqs-ubuntu.sh
Installing Hyperledger Composer prereqs for Ubuntu xenial
# Updating package lists
[sudo] password for playground:
gpg: keyring `/tmp/tmpz6hsrrim/secring.gpg' created
gpg: keyring `/tmp/tmpz6hsrrim/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
Error: retrieving gpg key timed out.
gpg: /tmp/tmpz6hsrrim/trustdb.gpg: trustdb created
gpg: key E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

I have gotten this issue before and it was always due to a connection issue. Wait a few minutes and run the pre-reqs script again. If you got the same error, create another user and go through all the installation steps on the new user, as sometimes it will cache a bad gpg key on the old user.

Thanks, It probably caused by the network connection. I will try it again.
Reply
#6
Hey,

I have a doubt over here(Step 8: Install Hyperledger Fabric)???

I followed the hyperledger docs(http://hyperledger-fabric.readthedocs.io...stall.html) and they have given to download the binaries and sample from curl -sSL http://bit.ly/2ysbOFE | bash -s 1.2.0. I downloaded under /fabric-samples. But i dont see the ./createpeerAdminCard.sh ?

You have used this URL curl -O https://raw.githubusercontent.com/hyperl...ers.tar.gz.

So what is the difference given in install guide and yours? Please help me on to understand this?
Reply
#7
With the official docs, are you following the installation guide from Hyperledger Fabric or Hyperledger Composer?
Reply