Ubuntu下HyperLedger fabric开发环境搭建
来源:互联网 发布:win8rt软件下载 编辑:程序博客网 时间:2024/05/17 04:48
转自: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 Harsha and @PriyaVasudevan.
- If you are new to Blockchain, please visit -https://www.ibm.com/blockchain/what-is-blockchain.html andhttps://www.hyperledger.org/.
- If you are a developer and looking for a systematic free online self-learning course, please visit - https://developer.ibm.com/courses/all-courses/blockchain-for-developers/
- If you want to use blockchain 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.
- IBM Bluemix garages for blockchain help 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 Run apt update to updates the list of available packages and their versions. Upgrade the packages to make sure they are up to date using apt-get upgrade. If required, update /etc/apt/sources.list using vi.
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.org using below commands -
mkdir -p /opt/gopath/src/github.com/hyperledger
cd /opt/gopath/src/github.com/hyperledger/
git clone http://gerrit.hyperledger.org/r/fabric
Now we need to set following environment variables in order to move forward. Alternatively you can write .bash_profile file 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 clone https://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:
- http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/devenv/
- https://www.ibm.com/blockchain/what-is-blockchain.html
- https://www.ibm.com/blockchain/for-business.html
- https://github.com/hyperledger/fabric/blob/master/docs/Setup/ca-setup.md
- http://hyperledger-fabric.readthedocs.io/en/latest/API/CoreAPI/#rest-api
- http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/
- https://www.ibm.com/blockchain/garage.html
- https://www.ibm.com/blockchain/bluemix.html
http://8btc.com/thread-41047-1-1.html
- ubuntu下搭建HyperLedger fabric开发环境
- Ubuntu下HyperLedger fabric开发环境搭建
- Hyperledger Fabric 开发环境搭建
- Hyperledger Fabric 开发环境搭建
- Ubuntu下搭建Hyperledger Fabric四个共识节点环境
- ubuntu16.10 搭建hyperledger-fabric开发环境
- Hyperledger Fabric 环境搭建
- Hyperledger Fabric 之 环境搭建
- IBM Hyperledger Fabric 开发环境搭建(windows环境)
- 在Ubuntu开发环境上安装Hyperledger Fabric
- Hyperledger Fabric 1.0 实战开发系列 第二课 Fabric环境搭建
- hyperledger fabric 1.0环境搭建出错记录
- Hyperledger fabric mac 环境搭建 001
- Hyperledger Fabric v1.0开发环境配置
- 在ubuntu环境下搭建fabric
- (一) Hyperledger Fabric在CentOS 7.2 64位系统的开发环境搭建
- Hyperledger Fabric 1.0 实战开发系列 第一课 系统环境搭建
- 区块链hyperledger fabric 环境搭建 centos7 docker环境
- PAT-B 1028. 人口普查(20)
- SQL数据库,如何把一张表从一个数据库中插入到另外一个数据库?
- 二、J2EE规范之 Servlet
- 数据库索引
- USACO 4.2解题报告
- Ubuntu下HyperLedger fabric开发环境搭建
- SQL_4th_插入insert、查询select、删除delete、更新update
- 学习计划
- JAVA代码性能优化
- Java面向对象
- androidstudio加载矢量图
- 合并有序数组
- 最小生成树
- MySQL ODBC 连接数据库中option的含义