当前位置:网站首页>Fabric v1.1 environment construction
Fabric v1.1 environment construction
2022-08-04 06:36:00 【Louzen】
之前搭建Fabric v1.1The construction process is not fully documented,It happened that the laboratory applied for a server to build the blockchain and re-installed while recording
in the local virtual machineCentOS 7.6,这里是CentOS 7.7,不知道有什么“惊喜”在等着我
参考杨毅 的 Hyperledger Fabric 开发实战
下面的命令都是在root环境下操作的
1. 初始化运行环境
1.1 Set ali toYUM源
# 更新yum
yum update
# 备份原来的YUM源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-base.repo.bak
# 设置阿里YUM源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 清理缓存并生成新的缓存
yum clean all
yum makecache
# 更新YUM源
yum update
1.2 Docker安装
# 卸载Docker旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
# 在线安装Docker CE
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
# 设置稳定存储库
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 安装最新版本的Docker CE
yum install docker-ce
# 执行查询Docker版本号,看是否安装成功
docker --version
# 后面运行docker时可能会报错
# Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
# 是docker服务没有启动,Just start it up
service docker start
1.3 Docker-Compose安装
# 安装curl(Docker-Compose需要服务器支持curl命令)
yum install curl
# 安装Docker-Compose,这里有个坑,`是esckey below the key,不是单引号
curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# If an error message is given as :
# -bash: /usr/bin/docker-compose: No such file or directory
# 或提示:cp /usr/local/bin/docker-compose /usr/bin
# 就执行下面的操作:
# cp /usr/local/bin/docker-compose /usr/bin
# If prompted again permission is not enough,Just give it permission to run
# chmod +x /usr/bin/docker-compose
# 查看docker-compose的版本
docker-compose --version
1.4 Go语言环境安装
# 下载1.10.1版本的Go语言包
curl -O https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz
# 将GoUnzip the language pack to /usr/local目录下
tar -C /usr/local -xzf go1.10.1.linux-amd64.tar.gz
# 配置go语言环境,To make environment variables permanent,需要在/etc/profile文件中添加如下两行
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/opt/gopath
# 到etc目录下,刷新配置
cd /etc
source profile
# 输出环境变量,测试是否成功
echo $PATH
# 查看Go语言版本
go version
# 创建go目录,这里的gopathis the path set earlier,The directory should be followed accordingly
# 源码存在src中,libInside is the bag,bin里是可执行文件
# mkdir -p 参数,递归创建目录,Multiple non-existing directories can be created at once
mkdir -p /opt/gopath/src
mkdir /opt/gopath/bin
mkdir /opt/gopath/lib
# srcto be placed after the directoryFabric文件
2 Fabric环境部署
2.1 Fabric源码安装
# 安装git
yum install git
# 运用go命令从github上获取源码,The source code will automatically appear in /opt/gopath/src目录中
# The download speed will be slow due to network factors,May experience multiple failures
go get github.com/hyperledger/fabric
# go get之后报错:can't load package: package github.com/hyperledger/fabric:
# no Go files in /opt/gopath/src/github.com/hyperledger/fabric
# 我看了下,srcBelow I created a series of directories myself,但是fabric下面没有文件,
# come againfabricdirectory and run againgo get的那条命令,At this point, the file was found to be downloaded
# 切换gitVersion branches torelease-1.1
# Some books or tutorials switch branches tov1.1.0,no!no!no!This branch is wrong,里面的bootstrap.sh有错误,This is mentioned belowsh文件
cd /opt/gopath/src/github.com/hyperledger/fabric/
git checkout release-1.1
2.2 Fabric镜像下载
# A script file that can automatically download the required image:
fabric/scripts/boostrap.sh
# 运行此脚本
./bootstrap.sh
# Wait for a while to download the image as shown below
# In addition, a file called bin的目录,Inside is a series of binaries necessary to run the blockchain
# binThe files are later put into the files that run the blockchain
# mirror effect:(研究不深,If there is any error, please leave a message,Correct me,谢谢!)
# cais a certificate authority mirror,Manage user public key and private key
# toolsIt is a tool for operating the blockchain,Can be considered as a client,Used to create a later namedcli的容器
# ordereris the orderer mirror
# peerIt is a normal node image
# javaenv是java运行环境,I don't know what works here for now,I thought it was runningjava编写的chaincode的
# ccenv也不清楚,I thought it was running in the container it createdgo写的chaincode
# zookeeper自行百度zookeeper
# kafka在fabric1.1The default consensus mechanism in the version is thatkafka,Synchronize information between nodes through Kafka
# couchdbis a database that stores string key-value pairs,对JsonStrings have rich query operations
3. 运行e2e_cli样例
# e2e_cli运行的是kafkaCluster's blockchain
# e2e_cli所在位置
fabric/examples/e2e_cli
# e2e_cliThe startup script file is
network_setup.sh
# 包含如下命令:(在下一次up前一定要down,否则报错)
./network_setup.sh up 启动e2e_cli
./network_setup.sh down 关闭e2e_cliand remove traces of the resulting files
./network_setup.sh restart 重启e2e_cli,就是先down再up
# 吹个牛逼,Half a year ago, I just got in touch with the blockchain for the first timee2e_cli的时候,Can't understand what went wrong
# There was no one at 2:40 in the morning,Baidu also did not have many results,Very desperate inside
# 现在就不同了,I see it throws an error:
e2e_cli/../../release/linux-amd64/bin/configtxgen: 没有那个文件或目录
# 好办,在前面2.2节运行bootstrap.sh生成了个bin目录,把这个bindirectory to put there
# The path reported above is the path below
/opt/gopath/src/github.com/hyperledger/fabric/release/linux-amd64/
# 若没有linux-amd64A directory is created
# I have herelinux-amd64,Also available in this directorybin目录,但是binThere is nothing in the directory
# 删除bin目录,将2.2节生成的bin复制到linux-amd64目录下,再启动e2e_cli
./network_setup.sh restart
# 运行成功结果如下
This shows that there is no problem with the blockchain environment,I'm going to build it nextkafkaCluster's blockchain,See my next blog
对了,The last interface is fine Ctrl + C 退出,再**./network_setup.sh down**清除痕迹
边栏推荐
- 分布式cache项目
- Deep learning, "grain and grass" first--On the way to obtain data sets
- A code example of the PCL method in the domain of DG (Domain Generalization)
- Socket编程详解
- LeetCode_Nov_1st_Week
- sbl_init.asm-适合在编辑模式下看
- LeetCode_Nov_2nd_Week
- [日常办公][杂项][vscode]tab space
- Pytest common plug-in
- [Deep Learning Diary] Day 1: Hello world, Hello CNN MNIST
猜你喜欢
随机推荐
LeetCode_Dec_1st_Week
亚马逊云科技Build On-Amazon Neptune基于知识图谱的推荐模型构建心得
【五一专属】阿里云ECS大测评#五一专属|向所有热爱分享的“技术劳动者”致敬#
C语言对文件的操作(完整版)
AWS使用EC2降低DeepRacer的训练成本:DeepRacer-for-cloud的实践操作
[English learning][sentence] good sentence
The usefulness of bind() system call
LeetCode_Dec_1st_Week
第三章 标准单元库(下)
Detailed steps to install MySQL
Completely remove MySQL tutorial
makefile基础学习
file permission management ugo
LeetCode_Dec_3rd_Week
FAREWARE ADDRESS
[daily office][ssh]cheatsheet
An abstract class, internal classes and interfaces
Vmmem 进程(WSL2)消耗内存巨大
Windows10重置MySQL用户密码
2020-03-27