转自:https://www.ibm.com/developerworks/community/blogs/8d277a63-4204-4fd3-8cb8-b7cb222cd522/entry/Steps_to_setup_Blockchain_Hyperledger_Fabric_0_6_development_environment_on_Ubuntu?lang=zh

We heard about Blockchain technology and understand its value to business. Here we would want to share our learnings with you all,acquired during setting up a single node Hyperledger blockchain dev environment during a client engagement. This entire installation & configuration takes 120-150 minutes. This blog is co-authored with@Krishna Harshaand@PriyaVasudevan.​


  • If you arenew to Blockchain,please visit -https://www.ibm.com/blockchain/what-is-blockchain.htmlandhttps://www.hyperledger.org/.
  • If you are a developer and looking for a systematicfree online self-learning course,please visit -https://developer.ibm.com/courses/all-courses/blockchain-for-developers/
  • If you want to useblockchain without installing & managing it,IBM Bluemix platform as a service (PaaS) provides convenient ways to test an IBM Blockchain network on the cloud -https://www.ibm.com/blockchain/bluemix.html.
  • IBMBluemix garages for blockchainhelp businesses accelerate the design and development of blockchain applications,For more info -https://www.ibm.com/blockchain/garage.html.

Let’s get started. As you can see from below snapshot,I am using Ubuntu 16.04.1 LTS machine with 8 core processor and 32 GB RAM. Using Putty I am accessing it as superuser.

Make sure network is configured properly and internet is accessible. You can check /etc/hosts and /etc/resolv.conf. Try to ping any web address to make sure everything is alright.

As a next step,you should update Runapt updateto updates the list of available packages and their versions. Upgrade the packages to make sure they are up to date usingapt-get upgrade. If required,update/etc/apt/sources.listusingvi.

Since the Hyperledger Fabric project is a ‘Go’project,you’ll need to install it first. Make sure its version is 1.6 or higher.

apt install golang-go

Once Go is installed. You can create necessary local folder and clone fabric fromgerrit.hyperledger.orgusing below commands -

mkdir -p /opt/gopath/src/github.com/hyperledger

cd /opt/gopath/src/github.com/hyperledger/

git clonehttp://gerrit.hyperledger.org/r/fabric

Now we need to set following environment variables in order to move forward. Alternatively you can write.bash_profilefile instead of setting variables every time.

export PATH=/usr/lib/go-1.6/bin:$PATH

export GOPATH=/opt/gopath/

export GOROOT=/usr/lib/go-1.6/

export PATH=/opt/gopath/src/github.com/hyperledger/fabric/build/bin/:$PATH

You would also need couple of libraries so run below command -

apt-get install -y cpp gccgo "build-essential" libsnappy-dev zlib1g-dev libbz2-dev docker.io curl

Next we’ll install and build RocksDB 4.1 along with its dependencies as we are not using Vagrant based setup.

cd /tmp

git clonehttps://github.com/facebook/rocksdb.git

cd rocksdb

git checkout v4.1

PORTABLE=1 make shared_lib

INSTALL_PATH=/usr/local make install-shared

Also build pip,behave and docker-compose using below commands.

apt install python-pip

pip install --upgrade pip

pip install behave nose docker-compose

pip install -I flask==0.10.1 python-dateutil==2.2 pytz==2014.3 pyyaml==3.10 couchdb==1.0 flask-cors==2.0.1 requests==2.4.3

With this we are ready to build the fabric (validating peer). This is probably most problematic step. If you missed any of the above step,it would not work. Use these commands.

cd $GOPATH/src/github.com/hyperledger/fabric

make peer

At stage-1,you would see your screen like this -

At stage-2,that’s how you screen looks like –

Stage-3

And

Stage-4

Once its successful,you are ready to setup CA server. The Certificate Authority (CA) provides a number of certificate services to users of a blockchain.

make membersrvc

With this installation part is done. Now lets Start node service (validating peer) –

peer node start

Run Certificate Authority (CA) server by starting member services –

membersrvc

Once both servers are started,You can access this blockchain setup for development or testing. You may need to understand which service is running on which port. Run below command to do that –

netstat -lnt

7050 – REST service listeining port

7051 – Peer service listening port

7052 – Used by CLI for callbacks

7053 – Event service on validating node

7054 - Certificate Authority (CA) listening port (Member services)

Once services are up and running. You can use REST API calls from any machine on network.

In the next blog,we’ll configure security,privacy and logging levels for this setup (http://ibm.biz/securebc).We’ll also see how to write,deploy,invoke and query chaincode (http://ibm.biz/chaincode). Thanks.

References:

  1. http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/devenv/
  2. https://www.ibm.com/blockchain/what-is-blockchain.html
  3. https://www.ibm.com/blockchain/for-business.html
  4. https://github.com/hyperledger/fabric/blob/master/docs/Setup/ca-setup.md
  5. http://hyperledger-fabric.readthedocs.io/en/latest/API/CoreAPI/#rest-api
  6. http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/
  7. https://www.ibm.com/blockchain/garage.html
  8. https://www.ibm.com/blockchain/bluemix.html


其他Hyperledger相关资源整理:

http://8btc.com/thread-41047-1-1.html

Ubuntu下HyperLedger fabric开发环境搭建的更多相关文章

  1. 详解Canvas实用库Fabric.js使用手册

    这篇文章主要介绍了详解Canvas实用库Fabric.js使用手册的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

  2. 使用Fabric SDK iOS访问Twitter用户时间线

    我试图在这个问题上挣扎两天.我正在使用FabricSDK和Rest工具包,试图为Twitter使用不同的RestAPIWeb服务.我可以使用具有authTokenSecret,authToken和其他值的会话对象的TWTRLogInButton成功登录.当我尝试获取用户时间线时,我总是得到失败的响应,作为:{“errors”:[{“code”:215,“message”:“BadAuthentic

  3. ios – 通过Fabric安装的Twitter,登录工作,请求推文的持久性错误

    我没有想法.解决方法当你请求推文时,我想你的代码如下所示,对吗?原来他们的文档不完整,应该是这样的客户端对象需要您的用户信息来完成它的工作.我遇到过同样的问题.

  4. ios – Xcode 6:在Fabric Crashlytics更新后找不到’Answers.h’文件

    我在Objective-C项目的Xcode6.3.2中的故事板中工作.我尝试构建时突然间出现错误:/…来看看我的变化,它只显示我所做的更改–这与Crashlytics无关.还有其他人看到这个吗?有人建议以最有效的方式恢复并重新开始工作吗?

  5. fabric-twitter – Twitter Fabric xcode – 上传分发时出错:归档分发错误:-3

    爱德华.解决方法当我更改目标的包标识符并尝试将其作为与以前相同的应用程序分发时,我收到此错误.我通过将我的应用程序注册为Fabric中的新应用程序解决了这个问题.

  6. ios – Fabric Crashlytics中缺少dSYM文件

    参见英文答案>Crashlytics:“We’remissingadSYMtoprocesscrashes”6从昨天起,我尝试在iOS应用程式中配置TwitterCrashlytics.我有一个问题wdSYMs文件.面料仪表板显示我的消息“我们缺少dSYMs文件”,所以我通过在线管理员上传文件(从此消息重定向),并显示此消息:但是如果我回到仪表板,系统丢失dSYMS文件的消息再次显示.我要做什么?

  7. ios – “Fabric.framework / run”构建阶段实际上做了什么?

    我使用Crashlytics框架在iOSApps中进行崩溃收集.使用框架时,会在运行/Fabric/Fabric.framework/run的目标中添加“构建阶段”.

  8. iOS Safari和/或Microsoft Edge是否支持推送通知?

    从我所做的研究来看,我找不到这个问题的具体答案.桌面版Safari已支持此功能一段时间了,但iOS版本是否也支持从网站推送通知?如果没有,是否有替代解决方案?我也无法在MicrosoftEdge上找到支持此功能的任何内容.我觉得我在某个时间点读过这个,但我现在很难找到任何东西.解决方法MicrosoftEdge目前不支持通知,但目前正在考虑使用用户语音的550票.您可以在status.modern.ie.上找到当前状态

  9. ios – 突然出现很多Fabric Out of Memory会话:Fabric OOM报告是否会出现误报?

    解决方法是的,在某些情况下,由于当前的OOM启发式而错误地检测到OOM.后台获取可能会错误地报告OOM.

  10. IBM Swift Sandbox-在PC上写Swift小程序

    然而幸运的是,IBM公司推出了网页版的Swift学习工具IBMSwiftSandbox,说是工具也不太准确,因为它只是一个网页,实质是我们在该网页敲代码,提交到IBM的服务器,IBM的服务器把运行结果显示给我们。下面用gif图来演示一下用IBMSwiftSandBox运行一个小程序。好啦,就介绍到这里啦,IBMSwiftSandBox上的一些功能就交给你自己去尝试了,尽情的在PC上学习Swift吧。

随机推荐

  1. crontab发送一个月份的电子邮件

    ubuntu14.04邮件服务器:Postfixroot收到来自crontab的十几封电子邮件.这些邮件包含PHP警告.>我已经解决了这些警告的原因.>我已修复每个cronjobs不发送电子邮件(输出发送到>/dev/null2>&1)>我删除了之前的所有电子邮件/var/mail/root/var/spool/mail/root但我仍然每小时收到十几封电子邮件.这些电子邮件来自cronjobs,

  2. 模拟两个ubuntu服务器计算机之间的慢速连接

    我想模拟以下场景:假设我有4台ubuntu服务器机器A,B,C和D.我想在机器A和机器C之间减少20%的网络带宽,在A和B之间减少10%.使用网络模拟/限制工具来做到这一点?

  3. ubuntu-12.04 – 如何在ubuntu 12.04中卸载从源安装的redis?

    我从源代码在Ubuntu12.04上安装了redis-server.但在某些时候它无法完全安装,最后一次makeinstallcmd失败.然后我刚刚通过apt包安装.现在我很困惑哪个安装正在运行哪个conf文件?实际上我想卸载/删除通过源安装的所有内容,只是想安装一个包.转到源代码树并尝试以下命令:如果这不起作用,您可以列出软件自行安装所需的步骤:

  4. ubuntu – “apt-get source”无法找到包但“apt-get install”和“apt-get cache”可以找到它

    我正在尝试下载软件包的源代码,但是当我运行时它无法找到.但是当我运行apt-cache搜索squid3时,它会找到它.它也适用于apt-getinstallsquid3.我使用的是Ubuntu11.04服务器,这是我的/etc/apt/sources.list我已经多次更新了.我尝试了很多不同的debs,并没有发现任何其他地方的错误.这里的问题是你的二进制包(deb)与你的源包(deb-src)不

  5. ubuntu – 有没有办法检测nginx何时完成正常关闭?

    &&touchrestarted),因为即使Nginx没有完成其关闭,touch命令也会立即执行.有没有好办法呢?这样的事情怎么样?因此,pgrep将查找任何Nginx进程,而while循环将让它坐在那里直到它们全部消失.你可以改变一些有用的东西,比如睡1;/etc/init.d/Nginx停止,以便它会休眠一秒钟,然后尝试使用init.d脚本停止Nginx.你也可以在某处放置一个计数器,这样你就可以在需要太长时间时发出轰击信号.

  6. ubuntu – 如何将所有外发电子邮件从postfix重定向到单个地址进行测试

    我正在为基于Web的应用程序设置测试服务器,该应用程序发送一些电子邮件通知.有时候测试是使用真实的客户数据进行的,因此我需要保证服务器在我们测试时无法向真实客户发送电子邮件.我想要的是配置postfix,以便它接收任何外发电子邮件并将其重定向到一个电子邮件地址,而不是传递到真正的目的地.我正在运行ubuntu服务器9.10.先感谢您设置本地用户以接收所有被困邮件:你需要在main.cf中添加:然后

  7. ubuntu – vagrant无法连接到虚拟框

    当我使用基本的Vagrantfile,只配置了两条线:我看到我的虚拟框打开,但是我的流氓日志多次显示此行直到超时:然后,超时后的一段时间,虚拟框框终于要求我登录,但是太久了!所以我用流氓/流氓记录.然后在我的物理机器上,如果我“流氓ssh”.没有事情发生,直到:怎么了?

  8. ubuntu – Nginx – 转发HTTP AUTH – 用户?

    我和Nginx和Jenkins有些麻烦.我尝试使用Nginx作为Jenkins实例的反向代理,使用HTTP基本身份验证.它到目前为止工作,但我不知道如何传递带有AUTH用户名的标头?}尝试将此指令添加到您的位置块

  9. Debian / Ubuntu – 删除后如何恢复/ var / cache / apt结构?

    我在ubuntu服务器上的空间不足,所以我做了这个命令以节省空间但是现在在尝试使用apt时,我会收到以下错误:等等显然我删除了一些目录结构.有没有办法做apt-getrebuild-var-tree或类似的?

  10. 检查ubuntu上安装的rubygems版本?

    如何查看我的ubuntu盒子上安装的rubygems版本?只是一个想法,列出已安装的软件包和grep为ruby或宝石或其他:)dpkg–get-selections

返回
顶部