CentOS7 builds blockchain HyperLedger fabric1.4 environment


The blogger currently needs to build a fabric1.4 environment. Start with the simplest single-machine deployment. I found some tutorials on the Internet for reference. Each has its own advantages and disadvantages. Simply organize a useful version by yourself and just make a record.

1. Installation

1. Check the CentOS kernel version

Use the command uname -r to view the current system kernel version. Docker requires the kernel version of the CentOS system to be higher than 3.10, mine is 3.10.0
Insert picture description here

2. Uninstall the old version of docker, docker-common docker-selinux docker-engine (if not installed, skip this step)

yum remove docker docker-common docker-selinux docker-engine

3. Install Go, git, python2, and node.

There are many online tutorials, which are not difficult, but there are a few points to note
: (1) The version of go must be 1.11 or above, use go version to view;
            (2) Python2 comes with general linux system
            (3) Node installs 8.X version Use node -v to view

4. Install docker 18.06.3.ce

The docker version is greater than 17.X. Here we choose the stable version of 18.06.3.
(1) Install yum-config-manager
        yum -y install yum-utils

(2) Add warehouse
        yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

(3) yum cache
        yum makecache

(4) Check the yum docker version
        yum list docker-ce.x86_64 --showduplicates |sort -r
Insert picture description here
Note: The installation of the specified version docker-ce 18.06 is dependent on docker-ce-selinux, you cannot install docker-ce-selinux directly

(5) Start the installation

First install docker-ce-selinux, this install the 17.03.2 version just
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce- 1.el7.centos.noarch.rpm

yum install policycoreutils-python -y
rpm -ivh docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

Install the latest stable version here yum -y install docker-ce-18.06.3.ce

(6) Start docker

[root@master ~]# systemctl start docker

Check if docker is running:
[root@master ~]# systemctl status docker

Set docker to start automatically after booting:
[root@master ~]# systemctl enable docker

Check docker version
[root@master ~]# docker version
Insert picture description here
docker run hello-world
will pull the hello-world image for the first time, a little slower,
there are a bunch of words before and after, there is a sentence Hello from Docker! in the middle, which proves that the installation is successful.

5. To install docker-compose, you need to install the version of docker-compose greater than or equal to version 1.14

$ sudo curl -L “https://github.com/docker/compose/releases/download/1.23.2/docker-compose- ( u n a m e − s ) − (uname -s)- (unames)(uname -m)” -o /usr/local/bin/docker-compose

$ sudo chmod +x /usr/local/bin/docker-compose

$ docker-compose -v
Insert picture description here

At this point, the software installation is basically over, the next step is to install the fabric source code.

2. Source code download

1. Download the Fabric source code and image

$ mkdir $GOPATH/src/github.com/hyperledger

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

$ git clone https://github.com/hyperledger/fabric.git

Switch version to 1.4
$ git checkout -b release-1.4 origin/release-1.4

$ cd fabric/script

Download the mirror
$ ./bootstrap.sh

2. Build the network and generate configuration

$ cd fabric/scripts/fabric-samples/first-network/

$ ./byfn.sh generate
This step will generate public and private keys, certificates, cryptogen, configtx, genesis block, anchor nodes, etc.
Insert picture description here

3. Start and close the network

$ ./byfn.sh up and
Insert picture description here
wait patiently. If the end appears, it means that the operation is normal and
Insert picture description here
interested. You can take a closer look at the log in the command line or study byfn.sh , which records in detail how to build your own blockchain network, including creating Channel, different nodes join the channel, update anchor nodes, install chain code, chain code instantiation, transfer operations in the e2e example, query transactions, etc.

Turn off the network

$ ./byfn.sh down

Concluding remarks

At this point, a simple fabric1.4 network has been successfully built, but here is just an official script to start the pre-configured file, which cannot be customized. You can run it step by step in byfn.sh.

In the future, there will be a special blog on parsing the byfn.sh script.

the above

Guess you like

Origin blog.csdn.net/u012140251/article/details/90445192