Hyperledger fabric source code compilation and installation-notes after many attempts

Hyperledger fabric source code compilation and installation

1. Sad journey:

现在网上大部分的安装过程都是要进过git,导致有些资源下不下来,网络很慢,急死个人~,进过自己试验,摸出了一套离线安装教程,其实哦,也不算是离线,只是相对于别的教程容易些。

2. Start of the topic:

step1: go language installation

参考博客:[go语言安装](https://blog.csdn.net/boling_cavalry/article/details/82904868)

step2: docker installation

参考博客:[docker安装](https://blog.csdn.net/b9567/article/details/105027440/)
基于我接触docker不多,先将docker部署在ubuntu18.04上的步骤记录一遍,以便日后使用。
2.1为保证docker未安装过或者安装失败过的机器,首先进行:
sudo apt-get remove docker docker-engine 
							docker-ce docker.io

2.2: Install docker

步骤如下:	
1.更新软件包
sudo apt-get update
2.安装docker所需要的环境,可以通过HTTPS使用存储库(repository)
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
3.添加Docker官方的GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.设置stable存储库
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5.更新索引
sudo apt-get update 
6.安装最新版的docker ce
$ sudo apt-get install -y docker-ce
至此,docker安装完毕。

After the installation is complete, verify and see if you have installed it properly

systemctl status docker
若未启动,命令如下:
sudo systemctl start docker
运行万年如一的helloworld程序
sudo docker run hello-world,结果如下图所示

docker helloworld

2.3 Add users

#创建docker用户组
sudo groupadd docker
#将当前用户添加到docker用户组
sudo usermod -aG docker $USER

2.4 Docker mirroring to use domestic sources

1.修改命令
sudo vim /etc/docker/daemon.json
2.配置镜像加速
{
    
    
 "registry-mirrors": ["http://hub-mirror.c.163.com"],
}
3.重启服务
sudo systemctl daemon-reload
sudo systemctl restart docker
4.验证docker版本
docker -v

3. Install docker-compose

The difference between the two:

3.1.Docker installation

Docker is an open source container engine that helps deliver applications faster. Convenience and speed are already the biggest advantage of Docker. Tasks that used to take days or even weeks can be completed in seconds under the processing of Docker containers.

3.2docker-compose

.Docker Compose is a command line tool provided by docker to define and run applications composed of multiple containers. Using compose, we can declaratively define each service of the application through the YAML file, and create and start the application by a single command.
Therefore, we have to install this software

1.安装python环境,大部分ubuntu18版本预装,故这里直接以已经安装的方式讲述
sudo apt-get install python-pip
2.下载docker—compose的二进制包:
curl -L https://github.com/docker/compose/releases/download/1.28.2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose

The blogger made a mistake during the installation, the reason here is a permission problem

执行以下命令解决烦恼
sudo chmod +x /usr/local/bin/docker-compose

3.3. Check whether docker-compose is installed successfully

命令
docker-compose -v
这里会出现版本号,要仔细看版本号,有个build啥的,
后面会有个unknow的这里就是安装没有成功的,解决办法,
执行了重装,简单粗暴,刺激~~~

4.fabric build

Since the children's shoes in the laboratory are familiar with fabric1.4, I will also install version 1.4 here.

4.1 Download the fabric installation package

Fabric1.4.4 version source code

1.执行命令,这里找个干净的目录即可
mkdir -p /root/go/src/github.com/hyperledger/
cd go/src/github.com/hyperledger/
2.使用xshell直接上传至该目录下,或者使用ftp
3.使用tar命令解开压缩包
4.cd fabric
执行:make release编译
这里会出现如下图所示的目录:

Insert picture description here
Compile the generated directory

把该目录加入配置文件让其生效
1.vim ~/.profile
2.export PATH=$PATH:/root/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin

4.2 Download the official fabric-simples sample

这里强调必须是要与boostrap.sh中的版本一致,博主这里使用1.4.4,故我们这里选择在github上手动下载这个文件,这里,博主已经下好,给出链接,用工具下载会快些


Unzip fabric-simples1.4.4 after downloading

解压命令
tar -xvf fabric-simples1.4.4.tar.gz
重命名
mv fabric-samples-1.4.4 fabric-samples

4.3 Download the required image

It should be noted here that the files in bootstrap.sh have to be modified at this time. The modified part is shown in the following figure. For the specific principles, you can read bootstrap.sh for details.
Bootstrap.sh needs to be annotated

4.4 Start to download the mirror

运行命令,注意这条命令是在fabric/scripts下
./bootstrap.sh

The required image will be downloaded here.
After the download is complete, the official sample is to be run.

4.5 Run the sample

1.cd /root/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network
2.   ./byfn.sh down 先关闭一下
3. ./byfn.sh up
4. 运行完,你就会发现新的世界

Alright, this is the step I summarized after programming for Baidu. I hope you can give me a three-in-one, thank you!
Running result graph

Guess you like

Origin blog.csdn.net/qq_36058264/article/details/115049825