"Recommended" HyperLedger fabric environment construction, testing and precautions [detailed instructions] [pro-Test effective]

Source: Internet
Author: User
Tags erro gpg install node git clone docker compose docker run couchdb hyperledger fabric

System: Ubuntu16.04 LTS

First, the Environment Preparation 1.1 Ubuntu installs the Crul
sudo Install Curl

Curl is an open source file Transfer tool that works with URL syntax in the command line mode. It is widely used in Unix, multiple Linux distributions, and has a ported version of DOS and Win32, Win64.

Role: File transfer

1.2 Installing Docker and Docker Compose

Docker-compose is a component that supports bulk creation of Docker containers through template scripting.

    • Pre-Preparation:

  Since the Docker version in the APT official library may be older, uninstall the old version that may exist:

sudo apt-get remove Docker-engine docker-ce Docker.io

  Update APT Package index:

sudo apt-get update

    • Configure the CE environment (Docker CE (Community Edition), which is the Docker Community Edition)
    1. Configure apt to allow a mirrored installation to be pulled in HTTPS mode:

      $ sudo apt-get install \    apt-transport-https \    ca-certificates \    curl \    Software-properties-common

    2. Add Docker official GPG key:

      $ Curl-fssl DOWNLOAD.DOCKER.COM/LINUX/UBUNTU/GPG | sudo apt-key add-

      Checksum 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 .

      $ sudo apt-key fingerprint 0ebfcd88

    3. Configure the stable image with the following command
      $ sudo add-apt-repository "Deb [ARCH=AMD64] Download.docker.com/linux/ubuntu $ (lsb_release-cs) stable"

    • Installing Docker
    1. Update APT Package index
      $ sudo apt-get update

    2. Install the latest version of Docker
      sudo apt-get install Docker-ce

      S

    3. Verify that Docker is installed successfully
      $ sudo docker run Hello-world

This command downloads a test image, launches a container to run the image, prints some information, and exits.

     

Refer to the Official tutorial: docs.docker.com/install/linux/docker-ce/ubuntu/#supported-storage-drivers

  At this point, Docker has been installed successfully on Ubuntu!

1.3 Installing go and NodeJS1.3.1 go

  To install the Go Language pack:

$ Curl-o storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz

When the download is complete, unzip to the/usr/local directory:

sudo tar -c/usr/local-xzf go1.10.1.linux-amd64.tar.gz

  To configure the GO locale variable:

Enter the. BASHRC Configuration environment variable:

$ sudo vim ~/. BASHRC or: $ sudo vim/etc/profile

Add the following code to the last side:

Export gopath=/usr/local/goexport path= $GOPATH/bin: $PATH

  

Save, exit.

To make an environment variable effective:

$ source ~/. BASHRC or: $ source/etc/profile

  

  After viewing the version number no problem, the configuration is successful.

1.3.2 node. js

Download node. js

$ CURL-SL https://

Install node. js

sudo Install -y Nodejs

  

Check version:

  

Second, Fabric installation 2.1 fabric Source Download
First create the corresponding directory, then enter the directory, using the git command to download the source code:
mkdir -P~/go/src/github.com/~/go/src/github.com/hyperledger git clone https:// Github.com/hyperledger/fabric.git

  

Since the fabric has been updated, all of us do not need the latest and latest source code, you need to switch to the v1.0.0 version of the source code:

CD ~/go/src/github.com/hyperledger/fabricgit checkout-b v1. 0.0

  

We can see that there are many files under the fabric source code. We go into the/examples/e2e_cli folder.

Download the image using the following command:

sudo download-dockerimages. sh -C x86_64-1.0. 0 -F x86_64-1.0. 0

When you're done downloading, view the version via Docker images.

The fabric environment is now complete.

Three, Tai Hang collection 3.1 permissions issues

The following issues occur:

warning:failed to get default registry endpoint from Daemon (Got permission denied whileTrying to connect to the Docker daemon sockets at Unix:///var/run/docker.sock:get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/info:dial Unix/var/run/docker.sock:connect: Permission denied). Using system default:index.docker.io/v1/Got Permission denied whileTrying to connect to the Docker daemon sockets at Unix:///Var/run/docker.sock:post http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/create?fromImage=hyperledger% 2ffabric-peer&tag=latest:dial Unix/var/run/docker.sock:connect:permission deniedGot Permission denied whileTrying to connect to the Docker daemon sockets at Unix:///var/run/docker.sock:post Http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/hyperledger/fabric-peer:latest/tag? Repo=hyperledger%2ffabric-peer&tag=latest:dial Unix/var/run/docker.sock:connect:permission denied

  

Similar errors can occur when you query the Docker version:

 while trying to connect to the Docker daemon sockets at Unix://var/run/docker.sock:get Http://%2Fva R%2frun%2fdocker.sock/v1.38/version:dial Unix/var/run/docker.sock:connect:permission denied

  

This is mainly the failure to get root permissions, caused by the error.

Workaround:

Grant Root permission.

sudo ./download-dockerimages. SH

3.2 Version Issues

If you get the latest version directly, you will end up with the following issues:

 for Hyperledger/fabric-javaenv:latest not found

  

  

Cause: Mainly because some of the components have not been updated to the latest version, only a few have the latest version. So add the version number when you download the component. In order to study the v1.0.0 of the data, I downloaded the version 1.0.0.

  

sudo ./download-dockerimages. SH  -C x86_64-1.0. 0 -F x86_64-1.0. 0

  

  

===>List out Hyperledger Docker Imageshyperledger/fabric-ccenv <none> 6ACF31E2D9A47Weeks ago1. 43GBhyperledger/fabric-orderer <none> 4baf7789a8ec7weeks ago 152MBhyperledger/fabric-peer <none> 82c262e659847weeks ago 159MBhyperledger/fabric-couchdb <none> 3092ECA241FC2Months ago1. 61GBhyperledger/fabric-tools Latest 0403FD1C72C7 -Months ago1. 32GBhyperledger/fabric-tools x86_64-1.0.00403fd1c72c7 -Months ago1. 32GBhyperledger/FABRIC-COUCHDB Latest 2fbdbf3ab945 -Months ago1. 48GBhyperledger/fabric-couchdb x86_64-1.0.02fbdbf3ab945 -Months ago1. 48GBhyperledger/fabric-kafka Latest DBD3F94DE4B5 -Months ago1. 3GBhyperledger/fabric-kafka x86_64-1.0.0Dbd3f94de4b5 -Months ago1. 3GBhyperledger/fabric-zookeeper Latest E545DBF1C6AF -Months ago1. 31GBhyperledger/fabric-zookeeper x86_64-1.0.0E545dbf1c6af -Months ago1. 31GBhyperledger/fabric-orderer Latest E317CA5638BA -months ago 179MBhyperledger/fabric-orderer x86_64-1.0.0E317ca5638ba -months ago 179MBhyperledger/fabric-peer Latest 6830DCD7B9B5 -months ago 182MBhyperledger/fabric-peer x86_64-1.0.06830dcd7b9b5 -months ago 182MBhyperledger/fabric-javaenv Latest 8948126f0935 -Months ago1. 42GBhyperledger/fabric-javaenv x86_64-1.0.08948126f0935 -Months ago1. 42GBhyperledger/fabric-ccenv Latest 7182C260A5CA -Months ago1. 29GBhyperledger/fabric-ccenv x86_64-1.0.07182c260a5ca -Months ago1. 29GBhyperledger/FABRIC-CA Latest a15c59ecda5b -months ago 238MBhyperledger/fabric-ca x86_64-1.0.0a15c59ecda5b -Months ago 238MB

3.3 Changing the obtained source

If it is a foreign source will be very slow and slow, need to ensure that apt source is domestic. Specific practices:

  Method One:

sudo vi/etc/apt/sources.list

Open this apt source list, if See is http://us.xxxxxx kind of, then is foreign, if see is http://cn.xxxxx kind of, then do not need to change. My is the source of the United States, so need to do a batch of replacement. In command mode, enter:

:%s/us./cn./g

You can change all of us to CN. Then enter: Wq to save the exit.

  Method Two:

Interface operation, follow-up supplement.

3.4 When testing the E2E network, ERR 001:

  

  

The most common is the Erro 001 cannot run peer because error when the setting up MSP from directory/opt/gopath/src/.... This problem is mainly due to the image is not complete and the reason for the lack of ltdl.h files, of course, also make sure that your fabric version is the same as the image version under you, I am using v1.0.0.

The solution is as follows:

1. Make sure that the fabric version is the same as the mirrored version you are under (we recommend using v1.0.0):

Enter Git checkout v1.0.0 in the fabric directory

View the images you have downloaded by entering Docker images.

If incorrect, enter Git clone gerrit.hyperledger.org/r/fabric-b v1.0.0 in the fabric directory

Make sure your version is v1.0.0.

The 2.erro 001 error is often caused by the inability to generate the public private key and the certificate correctly, and is tested as follows:

Resources:

Environment configuration:

1.78580746

2.79396618

3.80393119

4.78771475

6.78510191

7.http://www.netkiller.cn/journal/hyperledger.html

Error Resolution:

1.80888830 not very recommended

"Haste, if there is a mistake, please correct me! | | Welcome to learn to communicate together, please leave a comment in the comments area! "

This work is licensed under the Creative Commons Attribution-NonCommercial use-Share 4.0 International license agreement in the same way. 】

"Please contact the blogger, you must indicate the source after consent:http://www.cnblogs.com/X-knight/"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.