Hyperledger Fabric基础工具安装:docker、docker-compose、go
Docker-CE
1. 卸载docker旧版本(如果有):
2. 安装相关工具类:
3. 配置docker仓库:
4. 安装docker
5. 验证docker安装成功:
6. 关于非root用户使用docker命令
安装docker-compose
安装go
Docker-CE
1. 卸载docker旧版本(如果有):
- sudo yum remove docker \
- docker-client \
- docker-client-latest \
- docker-common \
- docker-latest \
- docker-latest-logrotate \
- docker-logrotate \
- docker-selinux \
- docker-engine-selinux \
- docker-engine
2. 安装相关工具类:
- sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3. 配置docker仓库:
- sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
- 由于国内访问不到docker官方镜像的缘故
- 可以通过aliyun的源来完成:
- sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4. 安装docker
- sudo yum install -y docker-ce
- #如果安装失败:
- sudo vim /etc/yum.repos.d/docker-ce.repo
- #通过命令把https://download-stage.docker.com替换为http://mirrors.aliyun.com/docker-ce
- #命令如下:
- :%s#https://download-stage.docker.com#http://mirrors.aliyun.com/docker-ce#g
5. 验证docker安装成功:
- #启动docker:
- sudo systemctl start docker
- docker -v
- sudo systemctl enable docker
- #验证docker:
- sudo docker run hello-world
-
- # 在阿里云开通容器镜像服务拿到加速地址再执行以下命令(加速地址前缀需要用自己的)
- sudo mkdir -p /etc/docker
- sudo tee /etc/docker/daemon.json <<-'EOF'
- {
- "registry-mirrors": ["https://mb7ebfhc.mirror.aliyuncs.com"]
- }
- EOF
- sudo systemctl daemon-reload
- sudo systemctl restart docker
6. 关于非root用户使用docker命令
非root用户在执行docker命令(如docker images)时,会出现以下错误:
- 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.39/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied
意思就是没权限读取
/var/run/docker.sock 文件内容,所以只要修改该文件读写权限即可:
- sudo chmod a+rw /var/run/docker.sock
安装docker-compose
- curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- docker-compose -v
安装go
- wget https://storage.googleapis.com/golang/go1.12.3.linux-amd64.tar.gz
- sudo tar -zxvf go1.12.3.linux-amd64.tar.gz -C /usr/local/
-
- sudo vi /etc/profile
- export GOROOT=/usr/local/go
- export GOBIN=$GOROOT/bin
- export GOPATH=/opt/gopath
-
- export PATH=$GOBIN:$PATH
-
- source /etc/profile
- go version
————————————————
版权声明:本文为CSDN博主「helloksyou」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:
https://blog.csdn.net/helloksyou/article/details/90516578ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158622937419726869037328%2522%252C%2522scm%2522%253A%252220140713.130056874..%2522%257D&request_id=158622937419726869037328&biz_id=0&utm_source=distribute.pc_search_result.none-task-blog-all_SOOPENSEARCH-9