操作系统:阿里云Ubuntu16.04
Git、Golang
Docker环境支持:docker、docker-compose
Fabric组件Docker镜像
Fabric源码库
sudo apt-get update
sudo apt install git
git version
参考文档:
https://docs.docker.com/install/linux/docker-ce/ubuntu/
https://yq.aliyun.com/articles/110806
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
docker version
网址:https://cr.console.aliyun.com/mirrors
参考文档:
https://docs.docker.com/compose/install/
最新版地址:
https://github.com/docker/compose/releases/
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
sudo groupadd docker
sudo usermod -aG docker ${USER}
sudo systemctl restart docker
su root #切换到root用户
su ${USER} #再切换到原来的应用用户以上配置才生效
中文社区网址:https://studygolang.com/dl
获取安装包:wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz
tar -zxvf go1.11.linux-amd64.tar.gz -C /usr/local
sudo vim /etc/profile
export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH
source /etc/profile
go version
go env
mkdir go
cd /home/go
mkdir -p src/github.com/hyperledger
cd src/github.com/hyperledger
git clone https://github.com/hyperledger/fabric.git
fabric
目录查看版本分支并切换分支cd fabric
git branch
此处选择对应版本或公开发行版,我选择v1.0.0
git checkout v1.0.0
fabrci/examples/e2e_cli/
目录,完成镜像下载,执行命令:cd /home/go/src/github.com/hyperledger/fabrci/examples/e2e_cli/
ls
source download-dockerimages.sh -c {tags:输版本号} -f {tags:输版本号}
source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0
docker images
./network_setup.sh up
显示END-E2E表示测试成功
docker exec -it cli bash
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","50"]}'
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
exit
./network_setup.sh down
解决方案:https://blog.csdn.net/hhtnan/article/details/79551969
/etc/resolv.conf 注释掉 options timeout:2 attempts:3 rotate single-request-reopen 重新执行
https://www.jianshu.com/p/7ff74cfc7125