1.安装go
先新建一个Go的工作空间文件夹,文件夹路径建议放在$HOME下:
userdeMacBook-Pro:~ user$ cd $HOME
userdeMacBook-Pro:~ user$ mkdir go
userdeMacBook-Pro:~ user$ $PATH
-bash: ./usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Java/JavaVirtualMachines/jdk-10.0..jdk/Contents/Home/bin:/usr/local/bin: No such file or directory
编辑.bash_profile文件,如果没有请新建。在文件末尾加上:
#GOPATH
export GOPATH=$HOME/go #GOBIN
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
编辑之后保存,然后执行source命令,使之生效:
userdeMacBook-Pro:~ user$ source .bash_profile
userdeMacBook-Pro:~ user$ $PATH
-bash: ./usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Java/JavaVirtualMachines/jdk-10.0..jdk/Contents/Home/bin:/usr/local/bin:/usr/local/bin:/Users/user/go/bin: No such file or directory
然后进行查看:
userdeMacBook-Pro:~ user$ go env
GOARCH="amd64"
GOBIN="/Users/user/go/bin"
GOCACHE="/Users/user/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/user/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2_/g5wrlg3x75zbzyqvsd5f093r0000gn/T/go-build566845913=/tmp/go-build -gno-record-gcc-switches -fno-common”
2.安装docker
1)下载并安装好Docker.dmg.download,来源:
https://store.docker.com/editions/community/docker-ce-desktop-mac
打开,此时电脑右上角就会出现一个类似鲸鱼的图标:
在运行Hyperledger Fabric时,请确保Docker处于开启状态:
然后就能查看出版本号了:
userdeMBP:~ user$ docker version
Client:
Version: 18.03.-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr ::
OS/Arch: darwin/amd64
Experimental: false
Orchestrator: swarm Server:
Engine:
Version: 18.03.-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr ::
OS/Arch: linux/amd64
Experimental: true
userdeMBP:~ user$ docker-compose --version
docker-compose version 1.21., build 5a3f1a3
2)接下来要进行的一些配置:
Mac电脑配置docker阿里云加速器时,preferences-daemon-register mirrors 中写上加速器地址,写的是别人的,但是也可以自己去申请。
总是提示
"registry-mirrors" :
No certs for ic2v8yz.mirror.aliyuncs.com
解决办法:将https改为http,然后在点击Apply&Restart就好了
但是后面发现运行./download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0 还是出错了:
userdeMacBook-Pro:e2e_cli user$ ./download-dockerimages.sh -c x86_64-1.0. -f x86_64-1.0.
Pull CA IMAGES
Pull FABRIC TAG
===> Pulling fabric Images
==> FABRIC IMAGE: peer Warning: failed to get default registry endpoint from daemon (Error response from daemon: Bad response from Docker engine). Using system default: https://index.docker.io/v1/
Error response from daemon: Bad response from Docker engine
然后后面查,原因是:
从docker1.3.2版本开始默认docker registry使用的是https,当你用docker pull 非https的docker regsitry的时候会报下面错误,所以上面的更改是错误的,不应该改成http
然后我就突然想起,最最开始为https的时候我没有点击apply&Restart,所以下载镜像的时候没能用上阿里云,所以下载timeout。
"registry-mirrors" :这个问题是可以忽略不计的,然后我点击apply&Restart后,再重新运行./download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0就成功了
这时候得出来的信息就是之前没下载完的镜像:
userdeMacBook-Pro:e2e_cli user$ ./download-dockerimages.sh -c x86_64-1.0. -f x86_64-1.0.
Pull CA IMAGES
Pull FABRIC TAG
===> Pulling fabric Images
==> FABRIC IMAGE: peer x86_64-1.0.: Pulling from hyperledger/fabric-peer
Digest: sha256:b7c1c2a6b356996c3dbe2b9554055cd2b63194cd7a492a83de2dbabf7f7e3c65
Status: Image is up to date for hyperledger/fabric-peer:x86_64-1.0.
==> FABRIC IMAGE: orderer x86_64-1.0.: Pulling from hyperledger/fabric-orderer
Digest: sha256:d0ea1f7e7ca04f0c4b7484f8835fd68e9bf13e6fcb700cf3a70f00a4059fc344
Status: Image is up to date for hyperledger/fabric-orderer:x86_64-1.0.
==> FABRIC IMAGE: couchdb x86_64-1.0.: Pulling from hyperledger/fabric-couchdb
........