1.安装环境

1)本机安装

前提是已经安装好了docker\docker-compose\go,相应的内容可见

docker-1-环境安装及例子实践

docker官方文档学习-1-Docker for mac安装配置

go安装可看:开始学习前的环境安装

然后可见本机环境版本信息为:

docker为:

userdeMacBook-Pro:~ user$ docker version
Client: Docker Engine - Community
Version: 18.09.
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov ::
OS/Arch: darwin/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 18.09.
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov ::
OS/Arch: linux/amd64
Experimental: false
Kubernetes:
Version: v1.10.3
StackAPI: v1beta2

docker-compose为:

userdeMBP:~ user$ docker-compose version
docker-compose version 1.23., build 1110ad01
docker-py version: 3.6.
CPython version: 3.6.
OpenSSL version: OpenSSL 1.1.0h Mar

go为:

userdeMacBook-Pro:~ user$ go version
go version go1.11.4 darwin/amd64

一开始docker中的镜像信息有:

userdeMacBook-Pro:~ user$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/kubernetes-dashboard-amd64 v1.10.1 f9aed6605b81 months ago 122MB
docker/kube-compose-controller v0.4.12 02a45592fbea months ago .8MB
docker/kube-compose-api-server v0.4.12 0f92c77fa676 months ago .2MB
k8s.gcr.io/kube-proxy-amd64 v1.10.3 4261d315109d months ago .1MB
k8s.gcr.io/kube-controller-manager-amd64 v1.10.3 40c8d10b2d11 months ago 148MB
k8s.gcr.io/kube-apiserver-amd64 v1.10.3 e03746fe22c3 months ago 225MB
k8s.gcr.io/kube-scheduler-amd64 v1.10.3 353b8f1d102e months ago .4MB
k8s.gcr.io/etcd-amd64 3.1. 52920ad46f5b months ago 193MB
k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64 1.14. c2ce1ffb51ed months ago 41MB
k8s.gcr.io/k8s-dns-sidecar-amd64 1.14. 6f7f2dc7fab5 months ago .2MB
k8s.gcr.io/k8s-dns-kube-dns-amd64 1.14. 80cc5ea4b547 months ago .5MB
k8s.gcr.io/pause-amd64 3.1 da86e6ba6ca1 months ago 742kB

这是因为安装了kubernetes

2)虚拟机安装

当然如果手动安装环境不顺利的情况下,我们也可以通过配置虚拟机来配置环境,这个的好处有:

使用vagrant集成的开发环境开发允许开发者使用自己喜欢的操作系统和编辑器来开发,同时又可以让系统运行在一个与开发团队一致的开发环境中。

当然首先需要有vagrant\virtualbox环境, vagrant\virtualbox的安装和版本可见virtualbox+vagrant学习-1-环境安装及vagrantfile的简单配置-Mac系统

参考https://blog.csdn.net/zgljl2012/article/details/52896372

首先需要下载fabric源码

userdeMacBook-Pro:~ user$ go get github.com/hyperledger/fabric
package github.com/hyperledger/fabric: no Go files in /Users/user/go/src/github.com/hyperledger/fabric

使用Vagrant启动虚拟机

进入/Users/user/go/src/github.com/hyperledger/fabric/devenv目录下,这里写好了安装虚拟机的配置文件,调用vagrant up来启动vagrant。这样就能够不用配置,直接使用开发人员设置好的开发环境:

userdeMBP:fabric user$ cd devenv/
userdeMBP:devenv user$ vagrant up
==> vagrant: A new version of Vagrant is available: 2.2. (installed version: 2.2.)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/xenial64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: hyperledger
==> default: Vagrant has detected a configuration issue which exposes a
==> default: vulnerability with the installed version of VirtualBox. The
==> default: current guest is configured to use an E1000 NIC type for a
==> default: network adapter which is vulnerable in this version of VirtualBox.
==> default: Ensure the guest is trusted to use this configuration or update
==> default: the NIC type using one of the methods below:
==> default:
==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter : nat
==> default: Forwarding ports...
default: (guest) => (host) (adapter )
default: (guest) => (host) (adapter )
default: (guest) => (host) (adapter )
default: (guest) => (host) (adapter )
default: (guest) => (host) (adapter )
default: (guest) => (host) (adapter )
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.1.
default: VirtualBox Version: 5.2
==> default: Mounting shared folders...
default: /vagrant => /Users/user/go/src/github.com/hyperledger/fabric/devenv
default: /local-dev => /Users/user/go/src/github.com/hyperledger
default: /hyperledger => /Users/user/go/src/github.com/hyperledger
default: /opt/gopath/src/github.com/hyperledger => /Users/user/go/src/github.com/hyperledger
==> default: Running provisioner: shell...
default: Running: inline script
default: ++ tee -a /etc/hosts
default: ++ echo '127.0.0.1 couchdb'
default: 127.0.0.1 couchdb
...

等到安装好后,运行vagrant ssh来进入该虚拟机:

userdeMacBook-Pro:devenv user$ vagrant ssh
Welcome to Ubuntu 16.04. LTS (GNU/Linux 4.4.--generic x86_64) * Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud packages can be updated.
updates are security updates. New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it. *** System restart required ***
vagrant@ubuntu-xenial:~$

参考https://blog.csdn.net/zgljl2012/article/details/52896372

过程中如果没成功,可能是因为网络被qiang的原因,可以到百度云手动安装box

https://pan.baidu.com/s/1kV57PLt?errno=0&errmsg=Auth%20Login%20Sucess&&bduss=&ssnerror=0&traceid=

然后运行:

vagrant box add hyperledger/fabric-baseimage virtualbox.box

再运行vagrant up即可

当然你也可以从virtualbox处进入

用户名和密码都为vagrant

然后此时查看该环境配置的版本信息:

vagrant@ubuntu-xenial:~$ go version
go version go1.11.5 linux/amd64 vagrant@ubuntu-xenial:~$ docker version
Client:
Version: 18.09.
API version: 1.39
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false
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/version: dial unix /var/run/docker.sock: connect: permission denied vagrant@ubuntu-xenial:~$ docker-compose version
docker-compose version 1.14., build c7bdf9e
docker-py version: 2.3.
CPython version: 2.7.
OpenSSL version: OpenSSL 1.0.1t May

上面的Got permission denied的解决办法是:

1)运行时在前面加一个sudo:

vagrant@ubuntu-xenial:~$ sudo docker version
Client:
Version: 18.09.
API version: 1.39
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 18.09.
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false

2)另一种解决办法就是docker守护进程启动的时候,会默认赋予名字为docker的用户组读写Unix socket的权限,因此只要创建docker用户组,并将当前用户加入到docker用户组中,那么当前用户就有权限访问Unix socket了,进而也就可以执行docker相关命令(参考https://www.cnblogs.com/informatics/p/8276172.html):

vagrant@ubuntu-xenial:~$ sudo groupadd docker //添加docker用户组
groupadd: group 'docker' already exists
vagrant@ubuntu-xenial:~$ sudo gpasswd -a $USER docker //将登陆用户加入到docker用户组中
Adding user vagrant to group docker
vagrant@ubuntu-xenial:~$ newgrp docker //更新用户组
vagrant@ubuntu-xenial:~$ docker version //测试果然成功
Client:
Version: 18.09.
API version: 1.39
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 18.09.
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false

然后安装镜像

安装好的虚拟机中也已经下载好了hyperledger/fabric,里面目录script中的bootstrap.sh文件中写好了需要安装的镜像信息,能够通过调用该文件来安装需要的镜像,如下:

vagrant@ubuntu-xenial:~$ cd /opt/gopath/src/github.com/hyperledger/fabric/scripts
vagrant@ubuntu-xenial:/opt/gopath/src/github.com/hyperledger/fabric/scripts$ ls
bootstrap.sh check_trailingspaces.sh goListFiles.sh
changelog.sh compile_protos.sh metrics_doc.sh
check_deps.sh fabric-samples multiarch.sh
check_license.sh generateHelpDocs.sh pull_build_artifacts.sh
check_spelling.sh golinter.sh run-integration-tests.sh
vagrant@ubuntu-xenial:/opt/gopath/src/github.com/hyperledger/fabric/scripts$ ./bootstrap.sh
./bootstrap.sh: line 179: [: too many arguments Installing hyperledger/fabric-samples repo
...
===> List out hyperledger docker images //运行到这,相应的镜像就已经安装好了
hyperledger/fabric-tools 1.4.0 0a44f4261a55 8 weeks ago 1.56GB
hyperledger/fabric-tools latest 0a44f4261a55 8 weeks ago 1.56GB
hyperledger/fabric-ccenv 1.4.0 5b31d55f5f3a 8 weeks ago 1.43GB
hyperledger/fabric-ccenv latest 5b31d55f5f3a 8 weeks ago 1.43GB
hyperledger/fabric-orderer 1.4.0 54f372205580 8 weeks ago 150MB
hyperledger/fabric-orderer latest 54f372205580 8 weeks ago 150MB
hyperledger/fabric-peer 1.4.0 304fac59b501 8 weeks ago 157MB
hyperledger/fabric-peer latest 304fac59b501 8 weeks ago 157MB
hyperledger/fabric-ca 1.4.0 1a804ab74f58 8 weeks ago 244MB
hyperledger/fabric-ca latest 1a804ab74f58 8 weeks ago 244MB
hyperledger/fabric-zookeeper 0.4.14 d36da0db87a4 4 months ago 1.43GB
hyperledger/fabric-zookeeper latest d36da0db87a4 4 months ago 1.43GB
hyperledger/fabric-kafka 0.4.14 a3b095201c66 4 months ago 1.44GB
hyperledger/fabric-kafka latest a3b095201c66 4 months ago 1.44GB
hyperledger/fabric-couchdb 0.4.14 f14f97292b4c 4 months ago 1.5GB
hyperledger/fabric-couchdb latest f14f97292b4c 4 months ago 1.5GB

3)可以看hyperledger中文文档学习-4-构建第一个fabric网络去开始构建一个简单的网络

hyperledge环境安装的更多相关文章

  1. 使用专业的消息队列产品rabbitmq之centos7环境安装

      我们在项目开发的时候都不可避免的会有异步化的问题,比较好的解决方案就是使用消息队列,可供选择的队列产品也有很多,比如轻量级的redis, 当然还有重量级的专业产品rabbitmq,rabbitmq ...

  2. Linux下xampp集成环境安装配置方法 、部署bugfree及部署禅道

    XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建站集成软件包.XAMPP 是一个易于安装且包含 MySQL.PHP 和 Perl 的 Apache 发行版.XAMPP 的确非 ...

  3. node.js环境安装,及连接mongodb测试

    1.node.js环境安装 npm config set python python2.7npm config set msvs_version 2013npm config set registry ...

  4. 谈谈React Native环境安装中我遇到的坑

    谈谈React Native环境安装 这个坑把我困了好久,真的是接近崩溃的边缘...整理出来分享给大家,希望遇到跟我一样问题的小伙伴能尽快找到答案. 首先,这是在初始化App之后,react-nati ...

  5. Kali Linux渗透测试实战 1.2 环境安装及初始化

    1.2 环境安装及初始化 目录(?)[-] 环境安装及初始化 下载映像 安装虚拟机 安装Kali Linux 安装中文输入法 安装VirtualBox增强工具 配置共享目录和剪贴板 运行 Metasp ...

  6. Linux初学 - Elasticsearch环境安装

    下载 https://www.elastic.co/downloads/elasticsearch 安装 rpm -ivh 也可以双击rpm包安装 修改elastaticsearch host配置 修 ...

  7. Win7下Python2.7环境安装paramiko模块

    Win7下Python2.7环境安装paramiko模块,经过安装并测试成功,整理文档如下: 1.下载安装Windows版本的Python2.7,我默认装在C:\Python27 我的python已经 ...

  8. [ALM]一步一步搭建MS ALM环境 - 安装TFS + SQL SERVER

    描述: 安装SQL SERVER 2012,安装TFS 2013,配置TFS,挽起袖子,准备干活儿 步骤: 1,打开Hyper-V Manager,参考[Hyper-V]使用操作系统模板创建新的虚拟机 ...

  9. Sencha Toucha 2 —1.环境安装配置、在线打包、离线打包

    环境安装配置        1. 下载 1.1     Sencha Touch 下载 http://cdn.sencha.com/touch/sencha-touch-2.2.1-gpl.zip 1 ...

随机推荐

  1. 19 个常用的 JavaScript 简写方法

    来自:SangSir 链接:https://segmentfault.com/a/1190000012673854 原文:https://www.sitepoint.com/shorthand-jav ...

  2. js的map遍历和array遍历

    1. array遍历: [1].forEach() forEach是ES5中操作数组的一种方法,主要功能是遍历数组.forEach方法中的function回调有三个参数:第一个参数是遍历的数组内容,第 ...

  3. POJ 1704 Georgia and Bob(阶梯Nim博弈)

    Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11357   Accepted: 3749 Description Geor ...

  4. maven 继承

    一个 maven 项目可以继承另一个 maven 的依赖, 称为子项目 父项目 使用场景: 多个子项目都需要某些依赖, 就可以把子项目共同的依赖抽取到父项目中, 子项目通过继承得到这些依赖, 这样也更 ...

  5. RabbitMQ 生产消息并放入队列

    前提已有 Exchange, Queue, Routing Key, 可以在 web 页面点击鼠标创建, 也可在消费端通过代码自动创建 web 页面配置步骤: https://www.cnblogs. ...

  6. 简单选择排序算法的C++实现

    简单选择排序采用最简单的选择方法,即在剩余序列中选出最小(或最大)的关键字,和剩余序列的第一个关键字交换位置,依次选择下去,直至使整个序列有序. 算法中两层循环的执行次数和初始序列没有关系,第二层循环 ...

  7. <自动化测试方案_4>第四章、选型标准

    第四章.选型标准 1,免费 2,工具可维护.可扩展 3,支持团队工作

  8. Linux中安装硬盘后对硬盘的分区以及挂载

    我将使用VM来进行模拟 先使用df看下我的电脑硬盘信息: df -h 可以看到只有一个sda1分区装载/boot,还有一个扩展分区 查看dev下的硬盘: 只有一个硬盘(两个分区) 注意: 如果你是ID ...

  9. Linux如何查看YUM的安装目录

    Linux下如何查看使用YUM安装过的包的安装路径呢? 在搞清楚这个问题前,我们先来了解一下YUM. YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和R ...

  10. FileInputStream、FileReader、FileWriter和File

    FileInputStream提供了对文件的字节读取 用于读取诸如图像数据之类的原始字节流       如:FileInputStream fis=new FileInputStream(new Fi ...