Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Fabric by linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces linux how to build Fabric, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

I. Environmental consolidation

1. CentOS upgrade the kernel

View the CentOS system

Cat / etc/redhat-release

The results show (version 7.4)

CentOS Linux release 7.4.1708 (Core)

Check the current CentOS system kernel version

Uname-sr

The results show (version 4.15)

Linux 4.15.14-1.el7.elrepo.x86_64

Ascending kernel requires CentOS to allow the use of ELRepo, which is a third-party repository that can upgrade the kernel to the latest mainline stable kernel.

Start ELRepo and run the following command

Rpm-- import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm-Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

After the repository is enabled, you can use the following command to list the available kernel-related packages:

Yum-disablerepo= "*"-enablerepo= "elrepo-kernel" list available

Next, install the latest mainline stable kernel

Yum-enablerepo=elrepo-kernel install kernel-ml

View available kernels

Cat / boot/grub2/grub.cfg | grep menuentry

The results show that:

Linux 4.15.14-1.el7.elrepo.x86_64 [root@VM_0_14_centos hyperledger] # cat / boot/grub2/grub.cfg | grep menuentry if [x "${feature_menuentry_id}" = xy] Then menuentry_id_option= "--id" menuentry_id_option= "" export menuentry_id_optionmenuentry 'CentOS Linux (4.15.14-1.el7.elrepo.x86_64) 7 (Core)'-- class centos-- class gnu-linux-- class gnu--class os-- unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-49f819fd-e56d-48a4-86d3-7ebe0a68ec88' {menuentry' CentOS Linux (0-rescue-f9d400c5e1e8c3a8209e990d887d4ac1) 7 (Core)'- class centos-- class gnu-linux-- class gnu--class os-- unrestricted $menuentry_id_option 'gnulinux-0-rescue-f9d400c5e1e8c3a8209e990d887d4ac1-advanced-49f819fd-e56d-48a4-86d3-7ebe0a68ec88' {

Replace the kernel you want to use, for example:

CentOS Linux (4.15.14-1.el7.elrepo.x86_64) 7 (Core) grub2-set-default 'CentOS Linux (4.15.14-1.el7.elrepo.x86_64) 7 (Core)

'

Check whether the kernel startup item is set successfully

Grub2-editenv list

The results show that:

Saved_entry=CentOS Linux (4.15.14-1.el7.elrepo.x86_64) 7 (Core)

Query redundant kernels

Rpm-qa | grep kernel

Delete redundant kernels

Yum remove

The kernel you want to delete

Just restart the system.

Reboot

II. Environmental installation and configuration

1. Docker installation

1.1 install Docker CE version, uninstall the old one first if there is any

Sudo yum remove docker\ docker-common\ docker-selinux\ docker-engine

1.2 start installing Docker ce

Sudo yum install-y yum-utils device-mapper-persistent-data lvm2 $sudo yum-config-manager\-add-repo\ https://download.docker.com/linux/centos/docker-ce.repo sudo yum-config-manager-enable docker-ce-edge sudo yum-config-manager-enable docker-ce-test sudo yum-config-manager-disable docker-ce-edge sudo yum makecache fast sudo yum install docker-ce

1.3 check whether the installation is successful

[root@VM_0_14_centos hyperledger] # docker-- versionDocker version 18.04.0-ce-rc1, build 0c7f7c6

1.4 start docker

/ bin/systemctl start docker.service

2. Docker-Compose installation

The server is required to support curl. If the server does not support curl, you need to install curl dependencies by doing the following

Yum install curl

2.1 install the latest version

According to the github project pointed to on the official website, the latest version of docker-compose is 1.15.0.

Execute a command

Curl-L https://github.com/docker/compose/releases/download/1.15.0/docker-compose-`uname-s`-`uname-m` > / usr/local/bin/docker-compose

Give authority

Chmod + x / usr/local/bin/docker-compose

2.2. View the version

[root@VM_0_14_centos hyperledger] # docker-compose-- versiondocker-compose version 1.15.0, build e12f3b9

Docker common commands

Kill all running containers

Docker kill $(docker ps-a-Q)

Delete all containers that have been stopped

Docker rm $(docker ps-a-Q)

Delete all mirrors

Docker rmi $(docker images-Q)

Force deletion of all mirrors

Docker rmi-f $(docker images-Q)

3. GO language installation

GO installation link

= = the final environment is as follows

Third, download the source code

1. First go to the path directory of go

Cd $GOPATH

2. Create a new folder

Mkdir-p src/github.com/hyperledger

3. Then go to the following path

/ opt/gopath/src/github.com/hyperledger

4. Download fabric

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

Go to the fabric directory to view the git version of fabric

Cd fabric/git branch-a

The result shows (currently using a master branch)

* master remotes/origin/HEAD-> origin/master remotes/origin/feature/ca remotes/origin/feature/convergence remotes/origin/master remotes/origin/release-1.0 remotes/origin/release-1.1 remotes/origin/v0.6 remotes/origin/v1.0.0-preview

4.2. Switch to the release-1.1 branch

Git checkout release-1.1

Check to see if the switch is successful

Git branch-a

The results show that

Master* release-1.1 remotes/origin/HEAD-> origin/master remotes/origin/feature/ca remotes/origin/feature/convergence remotes/origin/master remotes/origin/release-1.0 remotes/origin/release-1.1 remotes/origin/v0.6 remotes/origin/v1.0.0-preview

5. Download fabric-samples

5.1. enter a directory at the same level as fabric

Cd $GOPATH/src/github.com/hyperledger

5.2. Download the source code

Git clone https://github.com/hyperledger/fabric-samples.git

5.3, go to the fabric-samples directory, view the branches and switch to 1.1

Cd fabric-samples/git branch-agit checkout release-1.1

The structure after the download should look like the following figure

Download the image and the binaries to be executed

1. Enter the fabric-samples directory

= = if the network environment is good enough to access the external network, you can directly execute the following statement to download all mirrors and binary files to be executed

Curl-sSL https://goo.gl/6wtTN5 | bash-s 1.1.0

These two files, bin and config, will be added after the download is completed.

2. If you can't connect to the public network, click the following steps (download image and binary file)

Enter the scripts under the fabric directory

And modify bootstrap.sh

Cd fabric/scripts/vim bootstrap.sh

Modify the circle in the diagram to version 1.1.0, and then save

Image

Run the bootstrap.sh download image (wait a few minutes)

. / bootstrap.sh

3. Download the binary execution file

Go to the fabric-samples file

Cd fabric-samples/

Download version 1.1.0 binaries through wget

Wget https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/linux-amd64-1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz

If you extract the downloaded files, you will find that there are two more folders, bin and config.

Tar-zxvf hyperledger-fabric-linux-amd64-1.1.0.tar.gz

Configure bin to the environment

Cd bin/pwdvim / etc/profilesource / etc/profile

Modified item

5. Running files

Enter into fabric-samples/first-network

Cd fabric-samples/first-network/

Generate configuration file

. / byfn.sh-m generate

If you choose to agree, mychannel will be generated by default.

Start-up project

. / byfn.sh-m up

The result of success:

Close after success

. / byfn.sh-m down

= = to modify the docker-compose-base.yaml of the base folder for Ali CVM, add-GODEBUG=netdns=go under all environment, as shown in the following figure =

Thank you for reading this article carefully. I hope the article "how to build linux Fabric" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report