Transferred from: 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 their value to business. Here we would want to share our learnings with you all, acquired during setting up a single node Hyperledger blockchain de V Environment during a client engagement. This entire installation & configuration takes 120-150 minutes. This blog was co-authored with @Krishna Harsha and @PriyaVasudevan. If you areNew to Blockchain, please visit-https://www.ibm.com/blockchain/what-is-blockchain.html andhttps://www.hyperledger.org/. If you is a developer and looking for a systematicFree Online self-learning course, please visit-https://developer.ibm.com/courses/all-courses/blockchain-for-developers/if your 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/block Chain/garage.html.
Let ' s get started. As you can see from the below snapshot, I am using Ubuntu 16.04.1 LTS machine with 8 core processor and GB RAM. Using Putty I am accessing it as superuser.
Make sure network was 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 is 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 where you'll need to install it first. Make sure it 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 on 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 is 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 is ready to build the fabric (validating peer). This is the probably most problematic step. If you missed any of the above step, it would is not a work. Use these commands.
CD $GOPATH/src/github.com/hyperledger/fabric
Make peer
at Stage-1, would see your
At Stage-2, that's how to screen looks like–
Stage-3
and
Stage-4
Once its successful, your is ready to setup CA server. The Certificate Authority (CA) provides a number of Certificate services to users of a blockchain.
Make MEMBERSRVC
With the This installation. Now lets Start node service (validating peer) –
Peer node start
Run Certificate Authority (CA) server by starting member services–
MEMBERSRVC
Once Both servers is started, you can access this blockchain setup for development or testing. Need to understand which service are running on which port. Run below command to do that–
netstat-lnt