作者:业余爱好者 | 来源:互联网 | 2023-07-30 17:25
目录
一.电脑配置
二.新建虚拟机
三.安装所需工具
1.安装git
2.安装cURL
3.安装Docker
4.安装docker-compose
5.安装Golang
6.安装wegt
7.安装nvm
四.安装Fabric
一.电脑配置
VMware Workstation 16 pro :16.2.3 build-19376536
Windows10
CentOS7.6
![](https://img8.php1.cn/3cdc5/16086/9f3/9fbf2b98b13474c4.png)
二.新建虚拟机
![](https://img8.php1.cn/3cdc5/16086/9f3/c664feea92cf47e9.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/d5ee4242c9550cf3.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/8e05eb492fb57b20.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/a7a5e6f340abe7b9.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/600256d1542d2668.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/05a980f95abcdb8f.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/9fbf2b98b13474c4.png)
此状态完成之后,我就克隆了一份,用于搭建失败再次搭建
三.安装所需工具
1.安装git
输入:yum install git
![](https://img8.php1.cn/3cdc5/16086/9f3/d6ce608ff6733957.png)
2.安装cURL
输入:yum install curl
![](https://img8.php1.cn/3cdc5/16086/9f3/4dcc8c117765cb91.png)
3.安装Docker
输入:yum install docker
![](https://img8.php1.cn/3cdc5/16086/9f3/0eba988dea02827b.png)
4.安装docker-compose
输入:如图curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)。如图,指令是手打的可能错
![](https://img8.php1.cn/3cdc5/16086/9f3/dcac33b92f53960c.png)
5.安装Golang
传输下载好的go1.18.3并解压
![](https://img8.php1.cn/3cdc5/16086/9f3/711cca0d9e1d550c.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/5d471d1de2ed8a30.png)
设置环境变量
![](https://img8.php1.cn/3cdc5/16086/9f3/6975032a125fe51f.png)
版本号
![](https://img8.php1.cn/3cdc5/16086/9f3/78cb7a2dec0f04ff.png)
6.安装wegt
输入:yum install wegt
![](https://img8.php1.cn/3cdc5/16086/9f3/4b5d3c021ae1264a.png)
7.安装nvm
直接git无法成功,然后根据网上的方法设置hosts
![](https://img8.php1.cn/3cdc5/16086/9f3/d36af11b1f811bf8.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/7844b7019e9c0251.png)
1、通过git下载nvm:git clone git://github.com/creationix/nvm.git ~/nvm
2、下载完成后加入系统环境:source ~/.bashrc
![](https://img8.php1.cn/3cdc5/16086/9f3/db77ae6c97b577a4.png)
3、下载11.0.0版本:nvm install v11.0.0
![](https://img8.php1.cn/3cdc5/16086/9f3/ad09379b6bdbd269.png)
4.调入参数:export NVM_DIR="$HOME/.nvm"和[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
![](https://img8.php1.cn/3cdc5/16086/9f3/b0718019e8eb4a1e.png)
5.检查Node及npm版本:node -v && npm -v
![](https://img8.php1.cn/3cdc5/16086/9f3/ca19bfd035fb5216.png)
四.安装Fabric
按照如下步骤进行操作:
1.输入:git clone https://github.com/hyperledger/fabric.git。(网络原因,这里尝试了多次)
![](https://img8.php1.cn/3cdc5/16086/9f3/1ff7a2001552318d.png)
2.进入fabric,输入:git checkout v1.4.0
![](https://img8.php1.cn/3cdc5/16086/9f3/d05e2c7c8d6ea4aa.png)
3.输入:./bootstrap.sh。(网络原因,这里尝试了多次)
由于网络原因,执行bootstrap.sh时,很大可能下不下来hyperledger-fabric-linux-amd64-1.4.0.tar.gz
![](https://img8.php1.cn/3cdc5/16086/9f3/b3d0411e8bfff404.png)
4.在网上找到文件(hyperledger-fabric-linux-amd64-1.4.0.tar.gz)的压缩包,进入fabric-samples,解压缩
![](https://img8.php1.cn/3cdc5/16086/9f3/c6e60c20e44f0ea4.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/32110a4dc9a3ef7c.png)
5.输入:./byfn.sh up。但是遇到了问题如下
![](https://img8.php1.cn/3cdc5/16086/9f3/29f9f0cf8c2146a3.png)
6.进行如下操作,同样的错误仍然存在
# pull to local before using it
docker pull hyperledger/fabric-orderer:x86_64-1.0.0-rc1
# rename it to 'latest'
docker tag hyperledger/fabric-orderer:x86_64-1.0.0-rc1 hyperledger/fabric-orderer:latest
然后进入base,编辑文件base/docker-compose-base.yaml
看到image: hyperledger/fabric-orderer,将其修改成:mage: hyperledger/fabric-orderer:x86_64-1.0.0-rc1
![](https://img8.php1.cn/3cdc5/16086/9f3/82787197281c0e04.png)
7.再次修改,问题更新
image: hyperledger/fabric-orderer:x86_64-1.0.0
![](https://img8.php1.cn/3cdc5/16086/9f3/446ab077c4f1c505.png)
8.然后针对7新出现的问题,我采用如下方法:
在daemon.json文件中输入:{"registry-mirrors":["https://pee6w651.mirror.aliyuncs.com"]}
![](https://img8.php1.cn/3cdc5/16086/9f3/e46b616c878f0ad1.png)
9.再次./byfn.sh up,出现下面新的问题
![](https://img8.php1.cn/3cdc5/16086/9f3/05207577dd0191b8.png)
10.采用以下方式
systemctl status firewalld.service #查看防火墙状态
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
![](https://img8.php1.cn/3cdc5/16086/9f3/d99735a6a9113603.png)
11.出现了更加离谱的问题,于是我再将防火墙打开。问题回到9
12.对于9的问题,采用如下方法,问题仍然不变
![](https://img8.php1.cn/3cdc5/16086/9f3/fcb859d7629f16a9.png)
13.输入:$ docker rm -f $(docker ps -aq) && docker rmi -f $(docker images | grep dev | awk '{print $3}') && docker volume prue。问题仍然不变
14根据问题,查看docker:docker logs orderer.example.com
![](https://img8.php1.cn/3cdc5/16086/9f3/eb199ddd5ec81184.png)
15.有时,一些已经创建的 docker 卷有时会与您的新网络设置混淆。因此,为了避免这些事情,您可以使用以下方法停止网络并清理 docker 卷:docker volume prune 。问题仍然不变
![](https://img8.php1.cn/3cdc5/16086/9f3/11b0975c785f0a5f.png)
16.尝试:docker rm -f $(docker ps -aq)。问题仍然不变。
![](https://img8.php1.cn/3cdc5/16086/9f3/eef9ee0c60f630df.png)
17.执行如下操作,问题仍然存在
![](https://img8.php1.cn/3cdc5/16086/9f3/abcb7b38594254a1.png)
![](https://img8.php1.cn/3cdc5/16086/9f3/4f4c3f3fe5587604.png)
18.尝试在/etc/hosts中增加如下内容。问题仍然存在
![](https://img8.php1.cn/3cdc5/16086/9f3/cd5d785577d73e29.png)
问题尚未解决! (问题停留在在第九步,后面所做的步骤对问题毫无更新)。问题如下:
![](https://img8.php1.cn/3cdc5/16086/9f3/05207577dd0191b8.png)