Ubuntu18.0.4 no proxy quick installation hyperledger fabric1.4.0

As the need to download something foreign sites during fabric installation, slow death, I installed it Ben collapse, the benefit of the humanitarian spirit of the human spirit to write this tutorial Qin trace of blood and tears, hope you do not step on the pit, do happiness is not a waste of time programmers.

1, the installation required dependencies

$ sudo apt-get  install  git

$ sudo apt-get install vim 

2, replace the system software source

Backup original file

 $ sudo cp /etc/apt/sources.list  /etc/apt/sources.list.bak 

Delete the original file

$  sudo rm -rf /etc/apt/sources.list 

New and open the file

   $ sudo vim /etc/apt/sources.list 

Written to the source file, writes the following to open the sources.list file

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted 
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted 
#Added by software-properties 
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted 
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties 
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted 
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe 
#Added by software-properties 
deb http://mirrors.aliyun.com/ubuntu/ xenial universe 
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe 
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse 
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse 
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 
#Added by software-properties 
deb http://archive.canonical.com/ubuntu xenial partner 
deb-src http://archive.canonical.com/ubuntu xenial partner 
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted 
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe 
#Added by software-properties 
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe 
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

Update

 $ sudo apt update

3, installation docker

 $ sudo apt install docker.io

After installation, view the version, the word appears below the installation was successful:

$ docker --version
Docker version 18.09.7, build 2d0083d

Provided to the user can perform non-root docker, general users need to be added docker groups:

$ sudo usermod -aG docker 你的用户名 (重启生效)

4, the installation docker-compose

Using the following command to install docker-compose tools:

$ sudo apt install docker-compose

After installation, view the version, the word appears below the installation was successful:

$ docker-compose --version
docker-compose version 1.8.0, build unknown

Allow other users to execute commands related to compose:

$ sudo chmod +x /usr/share/doc/docker-compose

5, the installation Golang

Go download the installation package, the following is the download link, download linux version
https://studygolang.com/dl
to download the installation package is decompressed, usually automatically downloaded to the Downloads folder, unzip the files to usr / local

$ sudo tar  -zxvf ~/Downloads/go1.11.11.linux-amd64.tar.gz -C /usr/local/

Configuration environment variable, if you want all users to use the system Golang, edit / etc / profile file; if you just want the current user Golang, then edit the current .bashrc or .profile file in the user's $ HOME directory.

$ sudo gedit /etc/profile

In the profile file add the following:

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Use the source command to make the configuration take effect just added:

$ source /etc/profile

Use go version command to verify that the installation was successful

$ go version
go version go1.11.11 linux/amd64

6, pulling fabric Source

Create an empty directory and enter the directory:

$ mkdir -p ~/go/src/github.com/hyperledger 
$ cd ~/go/src/github.com/hyperledger

Pull fabric source
here focus here, you can see online tutorial source code on github pull all let go, but there is no proxy will be particularly slow speed, spend an afternoon, so we put https://github.com / hyperledger / fabric transit on gitee look, fast speed on the fly, address after I transfer to https://gitee.com/luckygirlcx/fabric, thus pulling the source code with the following:

git clone https://gitee.com/luckygirlcx/fabric.git 

View and switch the current branch, I switch version is 1.4.0

$ cd ./fabric
$ git branch -a  
$ git checkout v1.4.0 

7, pulling the mirror

Into the scripts folder

cd scripts

Here again, the focus
was originally a direct command with sudo ./bootstrap.sh run the file, press the command into three parts:

1, if the current directory does not hyperledger / fabric-samples, will be cloned from github.com hyperledger / fabric-samples repositories; use checkout to check out the corresponding specified version label; the specified version
2, Hyperledger Fabric and platform-specific binaries installation configuration file to the root directory fabric-samples in the repository;
3, download version Hyperledger Fabric Docker specified image file; Docker the downloaded image file is marked as "lastest".

However, since the second part is too slow to download binary files, the failure rate is too high, we just own manual install, instead of running bootstrap.sh script file, follow these steps:

7.1 File pull fabric-samples

fabric-samples are transferred from the github in gitee, pulling the original instruction git clone https://github.com/hyperledger/fabric-samples.git, pulling after transfer instruction:

$ git clone https://gitee.com/luckygirlcx/fabric-samples.git
$ cd ./fabric-samples
$ git branch -a
$ git checkout v1.4.0

I pulled it to my gitee, you can own transit, will pull an address change for your own transit address.

7.2 download executable binary files

Baidu download it on their own two binary files

hyperledger-fabric-Linux amd64-1.4.0.tar
hyperledger-fabric-ca Linux amd64-1.4.0.tar

Download the hyperledger-fabric-linux-amd64-1.4.0.tar compression bin and config have two folders within the package, hyperledger-fabric-ca-linux-amd64-1.4.0.tar have bin folder compression package, the two bin folder binaries are summarized in a bin folder. Finally, the bin and config folders to the fabric-samples folder.

7.3 download Docker image

Key focus ah ah, in order to download the fast and successful, this step must be the way
to add Ali cloud Docker Hub mirror to accelerate image download speed

$ sudo mkdir -p /etc/docker
$ sudo vim /etc/docker/daemon.json

Add the following to open a json file

{
    "registry-mirrors": ["https://obou6wyb.mirror.aliyuncs.com"]
}

Restart docker

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

Open bootstrap.sh script

$ sudo vim bootstrap.sh

See the end of the open file content for:

if [ "$SAMPLES" == "true" ]; then
  echo
  echo "Installing hyperledger/fabric-samples repo"
  echo
  samplesInstall
fi
if [ "$BINARIES" == "true" ]; then
  echo
  echo "Installing Hyperledger Fabric binaries"
  echo
  binariesInstall
fi
if [ "$DOCKER" == "true" ]; then
  echo
  echo "Installing Hyperledger Fabric docker images"
  echo
  dockerInstall
fi

We will process and binariesInstall front samplesInstall to comment out, becomes:
#if [ "$ the SAMPLES" == "to true"]; the then

#  echo
#  echo "Installing hyperledger/fabric-samples repo"
#  echo
#  samplesInstall
#fi
#if [ "$BINARIES" == "true" ]; then
#  echo
#  echo "Installing Hyperledger Fabric binaries"
#  echo
#  binariesInstall
#fi
if [ "$DOCKER" == "true" ]; then
  echo
  echo "Installing Hyperledger Fabric docker images"
  echo
  dockerInstall
fi

And then execute the script bootstarp.sh

$ sudo  ./bootstrap.sh

8, the test environment is enough to run a successful installation

The test environment is successfully installed

 $ cd ./fabric-samples/first-network/
 $ ./byfn.sh up

If the card to the following image, Congratulations on your successful installation.
Here Insert Picture Description

Closed network

$ ./byfn.sh down
Published an original article · won praise 0 · Views 36

Guess you like

Origin blog.csdn.net/qq_34452870/article/details/104501133