HyperLedger Fabric环境配置

1. 安装Git

确保系统和apt列表更新完全

apt-get upgrade -y

安装
apt install git
验证
git --version

2. 安装cURL

sudo apt install curl
验证
curl
输出

curl: try 'curl --help' or 'curl --manual' for more information

3. Docker 和 Docker Compose

清除系统残余docker文件
sudo apt-get remove docker docker-engine docker.io
更新
sudo apt-get update
安装

sudo apt-get install ca-certificates curl gnupg lsb-release

sudo mkdir -m 0755 -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

sudo docker run hello-world

通过执行以下命令来检查已安装的 Docker 的版本
docker --version
确保 docker daemon 是在运行着的。
sudo systemctl start docker
执行以下命令来检查已安装的 Docker Compose 的版本:
docker-compose --version

4. 拉取fabric镜像

克隆fabricgithub仓库
git clone https://github.com/hyperledger/fabric.git
下载fabric镜像,两种方式
sudo ./fabric/scripts/bootstrap.sh

curl -sSL https://bit.ly/2ysbOFE | bash -s
下载完成后,
docker images
若出现hyperledger/fabric镜像则成功

下载fabric-samples

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

启动基础网络
cd fabric-samples/test-network
在test-network目录中,运行以下命令删除先前运行的所有容器或工程:
./network.sh down
然后,通过执行以下命令来启动网络。
./network.sh up
如果成功会出现以下输出

Creating network "net_test" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating orderer.example.com    ... done
Creating peer0.org2.example.com ... done
Creating peer0.org1.example.com ... done
CONTAINER ID        IMAGE                               COMMAND             CREATED             STATUS                  PORTS                              NAMES
8d0c74b9d6af        hyperledger/fabric-orderer:latest   "orderer"           4 seconds ago       Up Less than a second   0.0.0.0:7050->7050/tcp             orderer.example.com
ea1cf82b5b99        hyperledger/fabric-peer:latest      "peer node start"   4 seconds ago       Up Less than a second   0.0.0.0:7051->7051/tcp             peer0.org1.example.com
cd8d9b23cb56        hyperledger/fabric-peer:latest      "peer node start"   4 seconds ago       Up 1 second             7051/tcp, 0.0.0.0:9051->9051/tcp   peer0.org2.example.com

详细文档:
使用Fabric的测试网络

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值