sudo apt-get install git
sudo apt-get install curl
1、安装docker与docker-compose
sudo apt-get install docker.io
sudo apt-get -y install docker-compose
2、检测docker安装情况
sudo systemctl start docker
sudo systemctl enable docker
sudo tar -zxvf ./go1.16.3.linux-amd64.tar.gz -C /usr/local/
2、配置环境变量
sudo vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
fi后面为添加部分
#如果这部分不修改在新的终端打开无法识别Go命令
sudo vim ~/.bashrc
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
3、让配置信息生效
source /etc/profile
source ~/.bashrc
4、字体颜色恢复(可能会导致字体颜色消失,按如下恢复)
cp .bashrc /root
cd /root
cat .bashrc
source .bashrc
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
vim hello.go
package main
import fmt
func main(){
fmt.Printf("Hello world\n")
}
go build hello.go //生成可执行文件hello
./hello
//输出 Hello world
1、创建一个Hyperledger文件
#参考实例
mkdir /go/src/githut.com/hyperledger
#进入hyperledger目录内
cd /go/src/githut.com/hyperledger
2、下载fabric源码
#需要VPN
git clone https://github.com/hyperledger/fabric.git
#下载完成会有如下文件时间较长耐心等待
1、进入fabric文件夹找到bootstrap.sh
#文件在 fabric/scripts/bootstrap.sh
./bootstrap.sh
#关闭VPN代理,时间较长,对于网络的稳定性有要求大概需要30~40分钟
./bootstrap.sh -s -b
#下载经常出问题,本人也是多次下载才成功的,上面的代码为只拉取docker镜像,因重新下载时间太长,如果只是docker镜像下载问题可以单独运行 ./bootstrap.sh -s -b
2、具体过程如下
./bootstrap.sh
Clone hyperledger/fabric-samples repo
===> Changing directory to fabric-samples
fabric-samples v2.3.1 does not exist, defaulting main
Pull Hyperledger Fabric binaries
===> Downloading version 2.3.1 platform specific fabric binaries
===> Downloading: https://github.com/hyperledger/fabric/releases/download/v2.3.1/hyperledger-fabric-linux-amd64-2.3.1.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 649 0 649 0 0 471 0 --:--:-- 0:00:01 --:--:-- 471
100 81.7M 100 81.7M 0 0 71140 0 0:20:05 0:20:05 --:--:-- 81787
==> Done.
===> Downloading version 1.4.9 platform specific fabric-ca-client binary
===> Downloading: https://github.com/hyperledger/fabric-ca/releases/download/v1.4.9/hyperledger-fabric-ca-linux-amd64-1.4.9.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 652 100 652 0 0 463 0 0:00:01 0:00:01 --:--:-- 463
100 23.6M 100 23.6M 0 0 59830 0 0:06:53 0:06:53 --:--:-- 59427
==> Done.
Pull Hyperledger Fabric docker images
FABRIC_IMAGES: peer orderer ccenv tools baseos
===> Pulling fabric Images
====> hyperledger/fabric-peer:2.3.1
2.3.1: Pulling from hyperledger/fabric-peer
801bfaa63ef2: Pull complete
e7f20c07c51b: Pull complete
bb00588ab247: Pull complete
8a823a5e7999: Pull complete
9308132a1c76: Pull complete
84d74acbd352: Pull complete
Digest: sha256:d5f302545f71dbf83d172dd5ec2d1106db7ac77883c67b4d72b23c801bcf16fc
Status: Downloaded newer image for hyperledger/fabric-peer:2.3.1
docker.io/hyperledger/fabric-peer:2.3.1
====> hyperledger/fabric-orderer:2.3.1
2.3.1: Pulling from hyperledger/fabric-orderer
801bfaa63ef2: Already exists
e7f20c07c51b: Already exists
400c127a54db: Pull complete
7d6bb7272303: Pull complete
745ed752c905: Pull complete
1f9702d08456: Pull complete
44ee6b99c7df: Pull complete
Digest: sha256:635a7fb0b0227a59ee07bb21c0c719d952b6f1c9da6cd5eaf449e6e3f39aafcd
Status: Downloaded newer image for hyperledger/fabric-orderer:2.3.1
docker.io/hyperledger/fabric-orderer:2.3.1
====> hyperledger/fabric-ccenv:2.3.1
2.3.1: Pulling from hyperledger/fabric-ccenv
188c0c94c7c5: Pull complete
0ef7d3d256c8: Pull complete
de9db76c5a1d: Pull complete
a99aea8d7e66: Pull complete
a5124c9860dc: Pull complete
0e91c50f714f: Pull complete
a0ebc98ad666: Pull complete
2139fe33a27c: Pull complete
f22d7e155f9b: Pull complete
Digest: sha256:881ebe5a56e2424431a073e1ba518f47b1bd7117ab12f0296c5fe465dcf72504
Status: Downloaded newer image for hyperledger/fabric-ccenv:2.3.1
docker.io/hyperledger/fabric-ccenv:2.3.1
====> hyperledger/fabric-tools:2.3.1
2.3.1: Pulling from hyperledger/fabric-tools
188c0c94c7c5: Already exists
0ef7d3d256c8: Already exists
de9db76c5a1d: Already exists
a99aea8d7e66: Already exists
a5124c9860dc: Already exists
e7b57d412333: Pull complete
04a826e76290: Pull complete
c53dc52418de: Pull complete
Digest: sha256:2fed59de66c3ad34b70e3abb644789b0fd8c66edc8be9fa624313fc2d366c6a2
Status: Downloaded newer image for hyperledger/fabric-tools:2.3.1
docker.io/hyperledger/fabric-tools:2.3.1
====> hyperledger/fabric-baseos:2.3.1
2.3.1: Pulling from hyperledger/fabric-baseos
801bfaa63ef2: Already exists
e7f20c07c51b: Already exists
e7ffd743a43f: Pull complete
Digest: sha256:4e35a94544f68e05598a499c36ac7bb1a73d7eaacfb0c8973c0f822f87224720
Status: Downloaded newer image for hyperledger/fabric-baseos:2.3.1
docker.io/hyperledger/fabric-baseos:2.3.1
===> Pulling fabric ca Image
====> hyperledger/fabric-ca:1.4.9
1.4.9: Pulling from hyperledger/fabric-ca
b8f262c62ec6: Pull complete
db9dbc6799b3: Pull complete
9c5c884a6020: Pull complete
370868734ec0: Pull complete
cbce57ae4cad: Pull complete
fc00299dbf2c: Pull complete
a1e42212f1ce: Pull complete
add0e148da22: Pull complete
Digest: sha256:28f50c6aa4f4642842e706d3ae6dcee181921d03bd30ab2a8b09b66e0349d92f
Status: Downloaded newer image for hyperledger/fabric-ca:1.4.9
docker.io/hyperledger/fabric-ca:1.4.9
===> List out hyperledger docker images
hyperledger/fabric-tools 2.3 d3f075ceb6c6 2 months ago 454MB
hyperledger/fabric-tools 2.3.1 d3f075ceb6c6 2 months ago 454MB
hyperledger/fabric-tools latest d3f075ceb6c6 2 months ago 454MB
hyperledger/fabric-peer 2.3 1e8e82ab49af 2 months ago 56.5MB
hyperledger/fabric-peer 2.3.1 1e8e82ab49af 2 months ago 56.5MB
hyperledger/fabric-peer latest 1e8e82ab49af 2 months ago 56.5MB
hyperledger/fabric-orderer 2.3 12f8ed297e92 2 months ago 39.6MB
hyperledger/fabric-orderer 2.3.1 12f8ed297e92 2 months ago 39.6MB
hyperledger/fabric-orderer latest 12f8ed297e92 2 months ago 39.6MB
hyperledger/fabric-ccenv 2.3 55dda4b263f6 2 months ago 502MB
hyperledger/fabric-ccenv 2.3.1 55dda4b263f6 2 months ago 502MB
hyperledger/fabric-ccenv latest 55dda4b263f6 2 months ago 502MB
hyperledger/fabric-baseos 2.3 fb85a21d6642 2 months ago 6.85MB
hyperledger/fabric-baseos 2.3.1 fb85a21d6642 2 months ago 6.85MB
hyperledger/fabric-baseos latest fb85a21d6642 2 months ago 6.85MB
hyperledger/fabric-ca 1.4 dbbc768aec79 6 months ago 158MB
hyperledger/fabric-ca 1.4.9 dbbc768aec79 6 months ago 158MB
hyperledger/fabric-ca latest dbbc768aec79 6 months ago 158MB
1、找到network.sh
#network.sh为可执行文件
cd /go/hyperledger/fabric/scripts/fabric-samples/test-network
./network.sh up createChannel
#./network.sh up 为开启网络
#./network.sh down 关闭网络
#如果顺利会出现如下显示
Ubuntu 20.04 非代理 全命令行 安装 hyperledger fabric 2.2.0
https://blog.csdn.net/Fine_rose/article/details/107554308
Fabric开发(五) Ubuntu20.04.1快速搭建Fabric2.2.0 (排雷版)
https://blog.csdn.net/aiwaston/article/details/108800937
Hyperledger Fabric 开发环境安装
https://blog.csdn.net/rejames/article/details/94673131
Fabric 环境搭建时bootstrap.sh帮我们做了什么?
https://blog.csdn.net/ltt1st/article/details/81332752
https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html
https://blog.csdn.net/qq_33923902/article/details/109529669