Skip to content

TrekkiDefi/fabric-samples-cn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fabric-samples-cn v1.1.0

脚本模块

环境安装

下载地址:

https://studygolang.com/dl

拷贝到/usr/local目录下解压

tar -zxvf go1.10.1.linux-amd64.tar.gz

$HOME(我这里为ubuntu用户目录)下新建gopath目录,并且新增src子目录。

cd src/

mkdir github.com

cd github.com

mkdir hyperledger

编辑.bashrc文件:

export GOPATH=$HOME/gopath
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
source .bashrc
下载fabric源码

将fabric源码Clone到hyperledger目录下。

git clone https://github.com/hyperledger/fabric.git
git checkout -b v1.1.0 v1.1.0
安装docker
sudo curl -fsSL https://get.docker.com | sh

安装结束后,会提示:

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker ubuntu

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

ubuntu加入docker用户组:

sudo usermod -aG docker ubuntu

然后执行如下命令启动docker:

# 使用下面的命令启动 Docker:
systemctl start docker

重新启动

systemctl restart docker

设置开机自启动

systemctl enable docker

查看状态

systemctl status docker

查看所有已启动的服务

systemctl list-units --type=service

执行docker ps查看docker容器,如果提示:

ubuntu@vm10-249-0-3:~$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.37/containers/json: dial unix /var/run/docker.sock: connect: permission denied

执行如下命令即可解决:

ubuntu@vm10-249-0-3:~$ newgrp - docker
ubuntu@vm10-249-0-3:~$ 
ubuntu@vm10-249-0-3:~$ 
ubuntu@vm10-249-0-3:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
ubuntu@vm10-249-0-3:~$
安装docker-compose
sudo apt-get update
sudo apt-get install python-pip
sudo pip install docker-compose

bootstrap.sh脚本

使用方法:

使用说明: bootstrap.sh [<version>] [<ca_version>] [-d -s -b]

  -d - 忽略下载docker镜像
  -s - 忽略克隆fabric-samples-cn代码库
  -b - 忽略下载fabric二进制文件

默认版本1.1.0

bootstrap.sh脚本主要执行如下操作:

  • 克隆fabric-samples-cn代码库;

    fabric-samples-cn代码库只提供了v1.1.0版本的支持;

  • 下载fabric二进制文件,并保存到fabric-samples-cn目录下的bin文件夹下;

    v1.1.0版本还会下载configtx.yaml、configtx.yaml、configtx.yaml配置文件;

  • 下载fabric docker镜像

💡 指定的版本不要加前缀v

cd /root/gopath/src/github.com/hyperledger/

# 克隆fabric-samples-cn库、下载fabric二进制文件、下载configtx.yaml、core.yaml、orderer.yaml配置文件、下载fabric docker镜像
curl -sSL https://raw.githubusercontent.com/fnpac/fabric-samples-cn/master/bootstrap.sh | bash -s 1.1.0 1.1.0

# 下载fabric二进制文件、下载configtx.yaml、core.yaml、orderer.yaml配置文件、下载fabric docker镜像
# 但不会克隆`fabric-samples-cn`库(仅支持1.1.0)
curl -sSL https://raw.githubusercontent.com/fnpac/fabric-samples-cn/master/bootstrap.sh | bash -s 1.0.6 1.0.6

💡 务必在fabric源码同级目录下执行上述命令操作

官方版本

当前你可以使用官方提供的脚本,其fabric-samples代码库提供了除v1.1.0外的其他版本。

cd /root/gopath/src/github.com/hyperledger/

curl -sSL https://goo.gl/6wtTN5 | bash -s 1.0.6 1.0.6

💡 指定的版本为fabric-samples tags中列出的tags, 如果指定其它版本,这会造成fabric-samples代码无法切换到指定版本的分支。

About

🐳 fabric v1.1.0 官方脚本中文标注

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published