The Fabric is introduced

Hyperledger Fabric is a platform that provides distributed ledger solutions. Hyperledger Fabric is powered by a modular architecture with excellent security, scalability, flexibility, and extensibility. Hyperledger Fabric is designed to support direct pluggable enablement of different modular components and to accommodate a variety of scenarios that are complex in economic ecosystems.

Hyperledger Fabric offers a unique scalable, scalable architecture, which is a significant difference between Hyperledger Fabric and other blockchain solutions. If you’re planning to deploy an enterprise-class blockchain with a full vetting mechanism and an open source architecture, Hyperledger Fabric is a good place to start.

Quote from: hyperledgercn. Making. IO/hyperledger…

Installation steps

The screenshots in this article are from The Mac OS platform, the same as Ubuntu. Part of this tutorial is for Mac OS

1. Install and configure Golang

Download the installation package (you can also download it at studygolang.com/dl)

mkdir ~/download
cd~ / wget download https://studygolang.com/dl/golang/go1.14.linux-amd64.tar.gzCopy the code

Unpack the

Sudo tar -c /usr/local -xzf go1.14.linux-amd64.tar.gzCopy the code

configuration

#Create go directory
mkdir $HOME/go
#Use vi to open ~./bashrc and configure environment variables
vi ~/.bashrc
#Insert it at the bottom
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
#This section describes how to enable the environment variables to take effect
source ~/.bashrc
#Check whether the configuration is correct
go version

#You are advised to enable Go Modules
go env -w GO111MODULE=on
#Configure the GOPROXY environment variable to speed up domestic downloading
#1. The official
go env -w  GOPROXY=https://goproxy.io
#2. Qiniu CDN (Recommended)
go env -w  GOPROXY=https://goproxy.cn
#3. Ali cloud
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
#View the GOPROXY configuration
go env | grep GOPROXY
Copy the code
Install curl (optional)
sudo apt install curl
Copy the code
3. Install Git (ignore if it is already installed)
sudo apt install git
Copy the code
Install Docker CE (Docker Community Edition)

Daocloud. IO/file for Docker and Docker Compose

Use curl to download and install the script

curl -sSL https://get.daocloud.io/docker | sh
Copy the code

Non-root users can also perform docker operations. You need to add the user to the Docker group (such as username). This step may take effect only after a restart

sudo usermod -aG docker username
Copy the code

Docker changed ali image source

Enter the cr.console.aliyun.com/cn-hangzhou… Request a dedicated mirror accelerator

Use /etc/docker/daemon.json to configure daemon:

cd  /etc/docker
sudo vi daemon.json
Copy the code

Add to the configuration file

{
  "registry-mirrors": ["Accelerator address"]}Copy the code

Restart the docker

sudo service docker restart
Copy the code

View docker information

docker info
Copy the code

Test the docker

docker run hello-world
Copy the code

Install Docker Compose

Download the Docker Compose

The curl -l https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose- ` ` uname - s - ` uname -m ` > /usr/local/bin/docker-composeCopy the code

Configuring Execute Rights

sudo chmod +x /usr/local/bin/docker-compose
Copy the code

Check whether the installation is successful

docker-compose -v
Copy the code
6. Download fabric and fabric-ca

Official: Fabric: github.com/hyperledger… Fabric-ca:github.com/hyperledger… Hyperledger-fabric – linux-AMd64-1.4.7.tar. gz Hyperledger-fabric – ca-linux-AMd64-1.4.7.tar. gz mac_V1.4.7.

Get the source code for fabric-sample

mkdir -p $GOPATH/src/github.com/hyperledger
cd $GOPATH/src/github.com/hyperledger
#Get the fabric-samples source code
git clone https://github.com/hyperledger/fabric-samples.git
#Go to the directory and switch the branch
cd fabric-samples
#You can choose the versionGit checkout v1.4.7#Check the version
git branch
Copy the code

Attachment: the fabric – samples_v1. 4.7. Zip

Decompress fabric and Fabric-ca (the decompressed bin needs to be combined) to get the bin and Config folders and place them in the fabric-sample directory

Open ~./bashrc with vi

vi ~/.bashrc
Copy the code

Add the following environment variables, save and exit

export PATH=$PATH:$GOPATH/src/github.com/hyperledger/fabric-samples/bin
Copy the code

Make the environment variable effective immediately

source ~/.bashrc
Copy the code

Verify that the environment variables are successful

fabric-ca-client version
Copy the code

7. Run tests

Find the first-network example

cd $GOPATH/src/github.com/hyperledger/fabric-samples/first-network
#Start the
sudo ./byfn.sh up
#If the startup fails, you may need to run the stop command first
#stop
sudo ./byfn.sh down
#Look at the Docker container after startup
docker ps -a
Copy the code

Start the first – network

After successful startup, view the Docker container list

Close the first – network

The Hyperledger Fabric environment has been installed.

Recommended reading

The official document: hyperledger – fabric. Readthedocs. IO/en/release -…

My open source project

Github.com/togettoyou/…