ubuntu中Hyperledger Fabric2.2环境搭建

一、ubuntu更换国内源

1、备份原始源文件source.list

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、修改源文件

(1) 编辑源文件

sudo gedit /etc/apt/sources.list 

(2)进入后删除里面的内容,添加阿里源并保存(以下的源是18.04的)

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

P.S.:不同版本的Ubuntu对应的源不同(参考这篇文章:Ubuntu

Ubuntu搭建Hyperledger Fabric环境并运行示例网络是一个相对复杂的流程,这里我会给出文字描述,由于无法直接提供截图,你可以按照这些步骤进行操作: **步骤1:更新系统和安装依赖** ``` sudo apt update sudo apt install -y git python3-dev python3-pip build-essential libssl-dev libffi-dev ``` **步骤2:创建虚拟环境** ``` python3 -m venv fabric-env source fabric-env/bin/activate ``` **步骤3:安装Fabric** ``` pip3 install fabric==2.6.0 pip3 install grpcio-tools pip3 install requests ``` **步骤4:下载Fabric示例代码** ``` git clone https://github.com/hyperledger/fabric-samples.git cd fabric-samples/first-network ``` **步骤5:配置环境变量** 打开`configtxgen`, `configtxlator`等文件夹下的`configtx.yaml`文件,根据需求修改组织(orgs)和证书路径。 **步骤6:创建证书** ``` ./network/config.sh ``` 这会生成一系列证书文件,用于节点的身份验证。 **步骤7:启动Fabric网络** 使用`docker-compose`启动网络,确保已经安装了Docker和Compose: ``` docker-compose up -d ``` 等待所有容器启动完毕。 **步骤8:运行 Fabric 示例应用** 选择一个链码示例,比如`ca`或`mycc`,然后执行链码相关的命令,比如查询信息或交易。 **步骤9:查看日志** ``` docker logs -f <container-name> ``` 这将显示容器的日志,帮助你跟踪网络的状态。 **步骤10:停止网络** 当实验完成后,使用`docker-compose down`来关闭所有容器。 请注意,实际的截图需要你自己在终端上操作,同时注意对敏感信息如证书和密钥的保护。如果你遇到任何问题,可以参考官方文档(https://hyperledger-fabric.readthedocs.io/en/release-2.2/quickstart.html)或在线教程。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值