热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

hyperledge环境安装

1.安装环境1)本机安装前提是已经安装好了docker\docker-compose\go,相应的内容可见docker-1-环境安装及例子实践docker官方文档学习

1.安装环境

1)本机安装

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

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

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

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

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

docker为:

userdeMacBook-Pro:~ user$ docker version
Client: Docker Engine
- CommunityVersion: 18.09.0API version: 1.39Go version: go1.10.4Git commit: 4d60db4Built: Wed Nov 7 00:47:43 2018OS/Arch: darwin/amd64Experimental: falseServer: Docker Engine - CommunityEngine:Version: 18.09.0API version: 1.39 (minimum version 1.12)Go version: go1.10.4Git commit: 4d60db4Built: Wed Nov 7 00:55:00 2018OS/Arch: linux/amd64Experimental: falseKubernetes:Version: v1.10.3StackAPI: v1beta2

docker-compose为:

userdeMBP:~ user$ docker-compose version
docker
-compose version 1.23.2, build 1110ad01
docker
-py version: 3.6.0
CPython version:
3.6.6
OpenSSL version: OpenSSL
1.1.0h 27 Mar 2018

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 2 months ago 122MB
docker
/kube-compose-controller v0.4.12 02a45592fbea 5 months ago 27.8MB
docker
/kube-compose-api-server v0.4.12 0f92c77fa676 5 months ago 41.2MB
k8s.gcr.io
/kube-proxy-amd64 v1.10.3 4261d315109d 9 months ago 97.1MB
k8s.gcr.io
/kube-controller-manager-amd64 v1.10.3 40c8d10b2d11 9 months ago 148MB
k8s.gcr.io
/kube-apiserver-amd64 v1.10.3 e03746fe22c3 9 months ago 225MB
k8s.gcr.io
/kube-scheduler-amd64 v1.10.3 353b8f1d102e 9 months ago 50.4MB
k8s.gcr.io
/etcd-amd64 3.1.12 52920ad46f5b 12 months ago 193MB
k8s.gcr.io
/k8s-dns-dnsmasq-nanny-amd64 1.14.8 c2ce1ffb51ed 14 months ago 41MB
k8s.gcr.io
/k8s-dns-sidecar-amd64 1.14.8 6f7f2dc7fab5 14 months ago 42.2MB
k8s.gcr.io
/k8s-dns-kube-dns-amd64 1.14.8 80cc5ea4b547 14 months ago 50.5MB
k8s.gcr.io
/pause-amd64 3.1 da86e6ba6ca1 14 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.4 (installed version: 2.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 1: nat
==> default: Forwarding ports...default: 7050 (guest) => 7050 (host) (adapter 1)default: 7051 (guest) => 7051 (host) (adapter 1)default: 7053 (guest) => 7053 (host) (adapter 1)default: 7054 (guest) => 7054 (host) (adapter 1)default: 5984 (guest) => 15984 (host) (adapter 1)default: 22 (guest) => 2222 (host) (adapter 1)
==> 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:2222default: SSH username: vagrantdefault: SSH auth method: private keydefault: Warning: Connection reset. Retrying...default: Warning: Remote connection disconnect. Retrying...default: default: Vagrant insecure key detected. Vagrant will automatically replacedefault: 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 ofdefault: VirtualBox! In most cases this is fine, but in rare cases it candefault: prevent things such as shared folders from working properly. If you seedefault: shared folder errors, please make sure the guest additions within thedefault: virtual machine match the version of VirtualBox you have installed ondefault: your host and reload your VM.default: default: Guest Additions Version: 5.1.38default: VirtualBox Version: 5.2
==> default: Mounting shared folders...default: /vagrant => /Users/user/go/src/github.com/hyperledger/fabric/devenvdefault: /local-dev => /Users/user/go/src/github.com/hyperledgerdefault: /hyperledger => /Users/user/go/src/github.com/hyperledgerdefault: /opt/gopath/src/github.com/hyperledger => /Users/user/go/src/github.com/hyperledger
==> default: Running provisioner: shell...default: Running: inline scriptdefault: ++ tee -a /etc/hostsdefault: ++ 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.5 LTS (GNU/Linux 4.4.0-141-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/cloud60 packages can be updated.
49 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/amd64vagrant@ubuntu-xenial:~$ docker version
Client:Version:
18.09.3API version: 1.39Go version: go1.10.8Git commit: 774a1f4Built: Thu Feb 28 06:40:58 2019OS/Arch: linux/amd64Experimental: 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.0, build c7bdf9e
docker
-py version: 2.3.0
CPython version:
2.7.13
OpenSSL version: OpenSSL
1.0.1t 3 May 2016

 

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

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

vagrant@ubuntu-xenial:~$ sudo docker version
Client:Version:
18.09.3API version: 1.39Go version: go1.10.8Git commit: 774a1f4Built: Thu Feb 28 06:40:58 2019OS/Arch: linux/amd64Experimental: falseServer: Docker Engine - CommunityEngine:Version: 18.09.3API version: 1.39 (minimum version 1.12)Go version: go1.10.8Git commit: 774a1f4Built: Thu Feb 28 05:59:55 2019OS/Arch: linux/amd64Experimental: 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.3API version: 1.39Go version: go1.10.8Git commit: 774a1f4Built: Thu Feb 28 06:40:58 2019OS/Arch: linux/amd64Experimental: falseServer: Docker Engine - CommunityEngine:Version: 18.09.3API version: 1.39 (minimum version 1.12)Go version: go1.10.8Git commit: 774a1f4Built: Thu Feb 28 05:59:55 2019OS/Arch: linux/amd64Experimental: 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网络去开始构建一个简单的网络

 

转:https://www.cnblogs.com/wanghui-garcia/p/10484774.html



推荐阅读
  • Docker安全策略与管理
    本文探讨了Docker的安全挑战、核心安全特性及其管理策略,旨在帮助读者深入理解Docker安全机制,并提供实用的安全管理建议。 ... [详细]
  • 从理想主义者的内心深处萌发的技术信仰,推动了云原生技术在全球范围内的快速发展。本文将带你深入了解阿里巴巴在开源领域的贡献与成就。 ... [详细]
  • 如何在U8系统中连接服务器并获取数据
    本文介绍了如何在U8系统中通过不同的方法连接服务器并获取数据,包括使用MySQL客户端连接实例的方法,如非SSL连接和SSL连接,并提供了详细的步骤和注意事项。 ... [详细]
  • 本文详细介绍了如何在 Ubuntu 14.04 系统上搭建仅使用 CPU 的 Caffe 深度学习框架,包括环境准备、依赖安装及编译过程。 ... [详细]
  • Ubuntu系统下的GIF动画录制解决方案
    在撰写文章或教程时,GIF动态图能够有效地传达信息。对于Windows用户而言,ScreenToGif是一款非常实用的工具。而在Ubuntu系统中,用户同样拥有多种选择来创建GIF动画,本文将重点介绍两款录屏工具——Byzanz和Peek。 ... [详细]
  • 函子(Functor)是函数式编程中的一个重要概念,它不仅是一个特殊的容器,还提供了一种优雅的方式来处理值和函数。本文将详细介绍函子的基本概念及其在函数式编程中的应用,包括如何通过函子控制副作用、处理异常以及进行异步操作。 ... [详细]
  • 入门指南:使用FastRPC技术连接Qualcomm Hexagon DSP
    本文旨在为初学者提供关于如何使用FastRPC技术连接Qualcomm Hexagon DSP的基础知识。FastRPC技术允许开发者在本地客户端实现远程调用,从而简化Hexagon DSP的开发和调试过程。 ... [详细]
  • CentOS下ProFTPD的安装与配置指南
    本文详细介绍在CentOS操作系统上安装和配置ProFTPD服务的方法,包括基本配置、安全设置及高级功能的启用。 ... [详细]
  • linux网络子系统分析(二)—— 协议栈分层框架的建立
    目录一、综述二、INET的初始化2.1INET接口注册2.2抽象实体的建立2.3代码细节分析2.3.1socket参数三、其他协议3.1PF_PACKET3.2P ... [详细]
  • 在尝试通过自定义端口部署Spring Cloud Eureka时遇到了连接失败的问题。本文详细描述了问题的现象,并提供了有效的解决方案,以帮助遇到类似情况的开发者。 ... [详细]
  • 本文详细介绍了Elasticsearch中的分页查询机制,包括基本的分页查询流程、'from-size'浅分页与'scroll'深分页的区别及应用场景,以及两者在性能上的对比。 ... [详细]
  • 在 Ubuntu 22.04 LTS 上部署 Jira 敏捷项目管理工具
    Jira 敏捷项目管理工具专为软件开发团队设计,旨在以高效、有序的方式管理项目、问题和任务。该工具提供了灵活且可定制的工作流程,能够根据项目需求进行调整。本文将详细介绍如何在 Ubuntu 22.04 LTS 上安装和配置 Jira。 ... [详细]
  • CentOS7通过RealVNC实现多人使用服务器桌面
    背景:公司研发团队通过VNC登录到CentOS服务器的桌面实现软件开发工作为防止数据外泄,需要在RealVNC设置禁止传输文件、访问粘贴板等策略过程&# ... [详细]
  • Kubernetes 1.9.0 Alpha.1 发布公告 [Kubernetes 最新动态]
    近日,Kubernetes 社区发布了两个新版本:1.8.0 RC.1 和 1.9.0 Alpha.1。这是 k8s 1.9.0 的首次发布,自 v1.8.0 Alpha.3 以来进行了大量更新,共提交了 279 次。 ... [详细]
  • Android 中的布局方式之线性布局
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
author-avatar
沫小兮
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有