-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhyperledger-pre.html
More file actions
391 lines (358 loc) · 28.2 KB
/
Copy pathhyperledger-pre.html
File metadata and controls
391 lines (358 loc) · 28.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!DOCTYPE html>
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description" content="This tutorial is an introduction to the Hyperledger blockchain fabric and is the first in a three part series to walk through how to install all the Hyperledger dependencies and execute ...">
<meta name="author" content="MLG Blockchain">
<!-- for Sharing -->
<meta property="og:title" content="Install Hyperledger Fabric on Ubuntu and execute Deploy, Invoke and Query - Part I | MLG Blockchain"/>
<meta property="og:type" content="article" />
<meta property="og:image" content="https://scontent.fyzd1-1.fna.fbcdn.net/v/t31.0-8/16113461_1203468529740802_8298128364201048788_o.jpg?oh=083f3a5ded0d20ca003f040dc24fd27c&oe=5959F050" />
<meta property="og:image:width" content="960"/>
<meta property="og:image:height" content="590"/>
<meta property="og:url" content="https://mlgblockchain.com/hyperledger-pre.html">
<meta property="og:description" content="This tutorial is an introduction to the Hyperledger blockchain fabric and is the first in a three part series to walk through how to install all the Hyperledger dependencies and execute ..." />
<link rel="shortcut icon" href="img/favicon.png">
<title>Install Hyperledger Fabric v1.0 on Ubuntu 16.04 and execute Deploy, Invoke and Query - Part I | MLG Blockchain</title>
<!-- Bootstrap Core CSS -->
<link href="assets/css/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css">
<!-- Retina.js - Load first for faster HQ mobile images. -->
<script src="assets/js/plugins/retina/retina.min.js"></script>
<!-- Font Awesome -->
<link href="assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- Default Fonts -->
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Raleway:400,100,200,300,600,500,700,800,900' rel='stylesheet' type='text/css'>
<!-- Modern Style Fonts (Include these is you are using body.modern!) -->
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Cardo:400,400italic,700' rel='stylesheet' type='text/css'>
<!-- Vintage Style Fonts (Include these if you are using body.vintage!) -->
<link href='https://fonts.googleapis.com/css?family=Sanchez:400italic,400' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Cardo:400,400italic,700' rel='stylesheet' type='text/css'>
<!-- Plugin CSS -->
<link href="assets/css/plugins/owl-carousel/owl.carousel.css" rel="stylesheet" type="text/css">
<link href="assets/css/plugins/owl-carousel/owl.theme.css" rel="stylesheet" type="text/css">
<link href="assets/css/plugins/owl-carousel/owl.transitions.css" rel="stylesheet" type="text/css">
<link href="assets/css/plugins/magnific-popup.css" rel="stylesheet" type="text/css">
<link href="assets/css/plugins/background.css" rel="stylesheet" type="text/css">
<link href="assets/css/plugins/animate.css" rel="stylesheet" type="text/css">
<!-- Vitality Theme CSS -->
<!-- Uncomment the color scheme you want to use. -->
<link href="assets/css/vitality-red.css" rel="stylesheet" type="text/css">
<link href="assets/css/mlg.css" rel="stylesheet" type="text/css">
</head>
<body id="page-top">
<!-- Start: Header Area
================================-->
<header class="header-background header header-2" id="header" data-stellar-background-ratio="0.5">
<div class="fix overlay-color">
<!-- Start: Navbar Area -->
<div class="header-navbar" id="header-navbar">
<!-- Navbar Option -->
<nav class="navbar navbar-inverse navbar-expanded" id="myNavbar" style="padding:10px 0px;">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- TEMPLATE LOGO -->
<a class="navbar-brand" href="index.html"><span><img src="assets/img/logo.png" alt="MLG Blockchain Consulting" class="img-responsive" style="width:100px"></span></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right" id="navbar-nav-2">
<li class="section-selector-2"><a class="btn page-scroll" href="index.html">Home</a></li>
<li class="section-selector-2"><a class="btn page-scroll" href="about.html">About</a></li>
<li class="section-selector-2"><a class="btn page-scroll" href="services.html">Services</a></li>
<li class="section-selector-2"><a class="btn page-scroll" href="clients.html">Clients</a></li>
<li class="section-selector-2 dropdown">
<a class="btn page-scroll dropdown-toggle" data-toggle="dropdown" href="news.html">News
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="press.html">Press</a></li>
<li><a href="announcements.html">Announcements</a></li>
</ul>
</li>
<li class="section-selector-2 dropdown">
<a class="btn page-scroll dropdown-toggle" data-toggle="dropdown" href="learn.html">Learn
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="bitcoin-tutorials.html">Bitcoin</a></li>
<li><a href="ethereum-tutorials.html">Ethereum</a></li>
<li><a href="hyperledger-tutorials.html">Hyperledger</a></li>
<li><a href="eris-tutorials.html">Eris</a></li>
<li><a href="blockchain-framework-tutorials.html">Other</a></li>
</ul>
</li>
<li class="section-selector-2"><a class="btn page-scroll" href="contact.html">Contact</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</div>
<!-- End: Navbar Area -->
<!-- Begin Content -->
<section class="post-content">
<div class="container">
<div class="row">
<br><br><br>
<!-- Begin page content -->
<div class="col-xs-12 col-md-9 col-md-push-3">
<div class="content-box">
<p class="blog-date"><span>6</span><br>Mar<br>2017</p>
<img src="https://i.ytimg.com/vi/EKa5Gh9whgU/maxresdefault.jpg" alt="How to Install Hyperledger Fabric v1.0 on Ubuntu 16.04 and execute Deploy, Invoke and Query - Part I">
</div>
<div class="post-info">
<span>Akarsh Agarwal | hyperledger, blockchain, docker, golang, blockchain development, hyperledger development, docker-engine</span>
</div>
<h2 class="section-title">Install Hyperledger Fabric on Ubuntu and execute Deploy, Invoke and Query - Part I</h2>
<div class="divider-light"></div>
<div class="page-content">
<p>There is an entire library of Blockchain APIs which you can select according to the needs that suffice your application. Some libraries are open-sourced and some are private. For examples, <a href="https://www.hyperledger.org/" target="_blank">IBM’s Hyperledger Fabric Project</a>, <a href="https://www.ethereum.org/" target="_blank">Ethereum</a>, <a href="https://www.openchain.org/" target="_blank">OpenChain</a> are few of the open sourced models which are popular in the market today.</a> </p>
<p>
This tutorial is to help you setup your development environment for a blockchain application using the IBM-Hyperledger Fabric API.
</p>
<p>
In this tutorial, we will be setting Hyperledger Fabric v1.0 on Ubuntu 16.04 on a localhost server. This tutorial can be applied to Ubuntu 14.04 too, but would involve certain changes to the commands due to the difference in the OS.
</p>
<p>
This tutorial is broken into 2 parts so that it is easier for you to understand and follow through the steps without making the article too long. The 1st part focuses on installing the prerequisites for the API and the 2nd part will focus on installing and running of Hyperledger API itself.
</p>
<h3>
Prerequesites
</h3>
<ul>
<li>
Go Language v1.8.x
</li>
<li>
Docker Engine
</li>
</ul>
<h3>
Go Language v1.8.x
</h3>
<p>
Go Language has been developed by Google and the IBM Hyperledger Fabric API uses Go for compiling and building. Go integrates the properties of C++ and Python into one language. It has fast runtime because it is a compiled language, similar to C++, as compared to an interpreted language like Python. It is also written in a similar way to Python so it benefits from have having a simpler syntax to C++. So, we get the faster speed and easiness of syntax in one package, Go.
</p>
<p>
To install the Go Language, we need to download the package from the official <a href="https://golang.org/dl/" target="_blank">Go Download Page</a>. To follow along with this tutorial, select the option in the Linux section, as described in the screenshot below (xx.tar.gz package).
</p>
<img src="assets/img/hyperledger-pre/download-go.jpg" class="img-responsive" alt="Download Golang">
<p>
Once the package is downloaded, we need to extract it and move it to /usr/local/ directory, so that our application can access it and more importantly, the Go files are situated at a safe place, where you don’t accidently delete them.
</p>
<p>
To extract the Go package, use the command below.
</p>
<code> sudo mv go /usr/local/ </code></br></br>
<img src="assets/img/hyperledger-pre/usr-local.jpg" class="img-responsive" alt="Extract Golang to proper folder">
<p>
When you see the directory (/usr/local/), you should now see that there is a new folder named “go”, in your directory. This shows that the go files have been correctly placed in the desired location. Here is a screenshot for you to verify and check whether you have something similar to this or not.
</p>
<p>
Now that we have the Go files in the correct place, we want to configure the terminal to locate the files when we want to execute any Go command. We need to include it into our environment variables. For this, we need to edit the ~/.bashrc file of the system, which keeps track of the environment variables of your system. To edit that file, use the following command.
</p>
<code> sudo nano ~/.bashrc </code></br></br>
<p>
Include the following lines at the end of the file
</p>
<code>
#GO VARIABLES</br>
export GOROOT=/usr/local/go</br>
export PATH=$PATH:$GOROOT/bin</br>
#END GO VARIABLES</br>
</code></br>
<p>
The PATH variable is the environment Path variable. The GOROOT variable defines where are your Go files situated in the system.
</p>
<p>
To reload the environment variables, we use the following command.
</p>
<code> source ~/.bashrc </code></br></br>
<p>
This command gives no output, but just simply reloads all the environment variable in background. Now, we can check the installation of Go in our terminal by typing:
</p>
<code> go </code></br></br>
<p>
If the installation was successful, you should see the following output.
</p>
<img src="assets/img/hyperledger-pre/go-installed.jpg" class="img-responsive" alt="Go installed correctly">
<p>
If you see any other output except this, maybe you might have done some mistake. Please go through the steps again above.
</p>
<p>
Now we have installed the Go language on the host machine and we are halfway through setup of prerequisites for the Hyperledger API, Congrats!.
</p>
<h3>
Docker Engine
</h3>
<p>
Docker is the container where you will be running your instances which makes sure that the blockchain application you run is available. Consider docker as a Virtual Machine Box, which runs images which have specific functionalities, just like Windows and Ubuntu, however each Docker image is smaller in size as compared to an Operating Systems. Each docker images will run a service associated with the Hyperledger network in your localhost. We shall cover two such services absolutely required by the Blockchain Network to run your application, in the next part of the tutorial. We will see how to install docker in this part.
</p>
<p>
We need to install docker on your system to be able to understand the beauty that lies within. So, let’s get started!
</p>
<p>
To install docker through CLI or Terminal, we will need to install two packages: Docker-engine and Docker-compose. Docker-engine is like the base package which makes all the necessary files available for the docker container to run properly. Docker-compose configures your docker images according to the specific configuration you provide, which will enable the Blockchain service.
</p>
<p>
To install docker-engine, enter the following command in the terminal.
</p>
<code> sudo apt-get install -y docker-engine </code></br>
<p>
Your output will differ from me as I have the Docker-Engine already installed on my system. But there is no error in the console, which ensures that it has been installed correctly. After you run the above command, docker should be installed on your system.
</p>
<img src="assets/img/hyperledger-pre/docker-install.jpg" class="img-responsive" alt="Install docker">
<p>
Now, we need to enable the docker service at startup of the system. We write the following commands:
</p>
<p>
To start the docker service:
</p>
<code> sudo service docker start</code></br></br>
<p>
If all goes well, there will be no output. If you get an error, please consider re-installing the docker-engine again.
</p>
<p>
To enable the docker to start at startup of the system, we use the following command:
</p>
<code> sudo systemctl enable docker </code></br></br>
<img src="assets/img/hyperledger-pre/docker-enable.jpg" class="img-responsive" alt="Enable docker">
<p>
If all goes well, your output should match with the screenshot displayed above. Now, each time you reboot your system, your docker container will be reloaded automatically.
</p>
<p>
To check if the docker service is running, just type:
</p>
<code> docker </code></br></br>
<p>
And you should get a similar output as below.
</p>
<img src="assets/img/hyperledger-pre/docker-run.jpg" class="img-responsive" alt="Run docker">
<p>If you get anything else, please consider re-installing the docker-engine.</p>
<p>Now, the second part of docker-engine is the docker-compose function, which is needed to configure the docker images you are calling.</p>
<p>For that, we use python’s pip. You can use the following command to install docker-compose:</p>
<code> sudo pip install docker-compose </code></br></br>
<img src="assets/img/hyperledger-pre/docker-compose.jpg" class="img-responsive" alt="Install docker-compose">
<p>The installation should complete without any red text at the bottom. This makes sure that we have our docker-engine and docker-compose properly installed in our system. But to work with the docker images, you need to add your user to the docker group, which was created during installation of docker-engine as a part of setup.</p>
<code> sudo usermod -aG docker $(whoami) </code></br></br>
<p>This command will provide no output. If any output is displayed, maybe there is something wrong with the command you just typed into your console. Please check if you have written the same line of code. After successfully completing, this adds your current logged in user to the docker group, which will enable you to run docker images.</p>
<p>So, at this point, we have setup our two essential packages, Go Language and Docker-Engine, which are required to run the Hyperledger Fabric API. The setup and installation part of Hyperledger Fabric API will be presented in the next part of the tutorial.</p>
<p>If you have any doubts or errors, please email hello@mlgblockchain.com and we shall get back to you as soon as possible, with a possible solution.</p>
<p>
<a href="index.html">MLG Blockchain</a> is a blockchain development and consulting firm based in Toronto that is focused on building next generation applications using blockchain and smart contract technology. View all our <a href="learn.html">blockchain development tutorials</a> at <a href="learn.html">www.mlgblockchain.com/learn.html</a>.
</p>
</div> <!-- End row -->
</div> <!-- End page content -->
<!-- Begin Sidebar -->
<div class="col-xs-12 col-md-3 col-md-pull-9">
<aside class="sidebar-nav">
<h3 class="sidebar-heading">Latest Posts</h3>
<ul>
<li><a href="setup-ethereum-on-aws-1.html">Use Go-Ethereum to Setup an Ethereum Blockchain on AWS</a></li>
<li><a href="setup-hyperledger-fabric.html">How to Setup the Hyperledger Fabric on Ubuntu</a></li>
<li><a href="intro-ipfs.html">How to Get Started with IPFS Decentralized Storage</a></li>
<li><a href="hyperledger-pre.html">How to Install Hyperledger Fabric v1.0 on Ubuntu 16.04 and execute Deploy, Invoke and Query - Part I</a></li>
<li><a href="intro-blockchain.html">A Simple Introduction to Understand the Blockchain</a></li>
<li><a href="meteor-wallet.html">How to Use Meteor to Create an Ethereum Wallet</a></li>
<li><a href="intro-embark.html">How to Get Started with the Embark Framework</a></li>
<li><a href="crypto-signature.html">How to Use Go to Create a Crypto Signature</a></li>
<li><a href="setup-bitcoind.html">How to Connect to the Bitcoin Blockchain with Bitcoind</a></li>
<li><a href="eris-chain.html">How to Setup a Private Blockchain with Eris</a></li>
<li><a href="sol-wallet.html">How to Setup a Wallet Smart Contract with Solidity</a></li>
<li><a href="ethereum-private-network.html">Use Go-Ethereum to Setup your own Private Ethereum Blockchain</a></li>
<li><a href="intro-sol-contracts.html">Get started with solidity and ethereum smart contracts</a></li>
<li><a href="ethereumjs-sign.html">Use Ethereumjs-tx and Web3 to Send an Ether Transaction using your Terminal</a></li>
<li><a href="bitcoinjs-address.html">Use Bitcoinjs to generate a new Bitcoin address and private key</a></li>
</ul>
</aside>
</div> <!-- End Sidebar -->
</div> <!-- End row -->
</div> <!-- End container -->
</section> <!-- End Content section -->
<section class="cta-form" id="contact" style="background-image: url('assets/img/homepage/plexus.jpg')">
<div class="container text-center">
<h4 style="color:white">Be the first to hear about the newest advancements in blockchain technology!</h3>
<hr class>
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- MailChimp Signup Form -->
<div id="mc_embed_signup">
<!-- Replace the form action in the line below with your MailChimp embed action! For more informatin on how to do this please visit the Docs! -->
<form role="form" action="//mlgblockchain.us15.list-manage.com/subscribe/post?u=aed601a0f8af2bb3c70ffe3ac&id=1b4e498474" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" target="_blank" novalidate>
<div class="input-group input-group-lg">
<input type="email" name="EMAIL" class="form-control" id="mce-EMAIL" placeholder="Email address...">
<span class="input-group-btn">
<button type="submit" name="subscribe" id="mc-embedded-subscribe" class="btn btn-primary">Subscribe!</button>
</span>
</div>
<div id="mce-responses">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</form>
</div>
<!-- End MailChimp Signup Form -->
</div>
</div>
</div>
</section>
<footer id="footer" class="footer">
<div class="container text-center">
<div class="row" style="color:black">
<div class="col-md-4 contact-details">
<h4><i class="fa fa-phone"></i> Call</h4>
<p>647-377-3489</p>
</div>
<div class="col-md-4 contact-details">
<h4><i class="fa fa-map-marker"></i> Visit</h4>
<p>Toronto, Canada</p>
</div>
<div class="col-md-4 contact-details">
<h4><i class="fa fa-envelope"></i> Email</h4>
<p style="color:black">hello@mlgblockchain.com</p>
</div>
</div>
<div class="row copyright">
<div class="col-lg-12">
<center><a href="index.html"><img src="assets/img/mlg.png" alt="MLG Blockchain Consulting" class="img-responsive" style="width:100px"></a></center>
<br>
<p class="small" style="color:black">© 2017 MLG Blockchain Consulting</p>
</div>
</div>
</div>
</footer>
<!-- SCRIPTS
========================================-->
<!-- Core Scripts -->
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap/bootstrap.min.js"></script>
<!-- Plugin Scripts -->
<script src="assets/js/plugins/google-analytics.js"></script>
<script src="assets/js/plugins/jquery.easing.min.js"></script>
<script src="assets/js/plugins/classie.js"></script>
<script src="assets/js/plugins/cbpAnimatedHeader.js"></script>
<script src="assets/js/plugins/owl-carousel/owl.carousel.js"></script>
<script src="assets/js/plugins/jquery.magnific-popup/jquery.magnific-popup.min.js"></script>
<script src="assets/js/plugins/background/core.js"></script>
<script src="assets/js/plugins/background/transition.js"></script>
<script src="assets/js/plugins/background/background.js"></script>
<script src="assets/js/plugins/jquery.mixitup.js"></script>
<script src="assets/js/plugins/wow/wow.min.js"></script>
<script src="assets/js/contact_me.js"></script>
<script src="assets/js/plugins/jqBootstrapValidation.js"></script>
<!-- Vitality Theme Scripts -->
<script src="assets/js/vitality.js"></script>
</body>
</html>