更新日期:20190711
参考fabric文档

文章目录

  • 1. 准备工作
    • 1.1 install cURL
    • 1.2 Docker and Docker Compose
    • 1.3 Go Programming Language
    • 1.4 Node.js Runtime and NPM
    • 1.5 Python
  • 2 安装示例,二进制和镜像
  • 3 BYFN
    • 3.0 help
    • 3.1 generate
    • 3.2 up
    • 3.3 down

1. 准备工作

1.1 install cURL

Mac自带有cUrl,因此我未执行安装。官方文档中建议安装最新版:

Download the latest version of the cURL tool if it is not already installed or if you get errors running the curl commands from the documentation.

查看当前cURL版本

AppledeiMac-2:~ apple$ curl --version
curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy

1.2 Docker and Docker Compose

You will need the following installed on the platform on which you will be operating, or developing on (or for), Hyperledger Fabric:

MacOSX, *nix, or Windows 10: Docker Docker version 17.06.2-ce or greater is required.
Older versions of Windows: Docker Toolbox - again, Docker version Docker 17.06.2-ce or greater is required.

按照菜鸟教程中docker的手动下载安装的方式:

下载 Stable 或 Edge 版(此处我安装的是Stable版本),安装过程与普通dmg程序相同。
安装完成后启动一下(刚安装成功,这里有一个启动的按钮):

验证安装成功:

AppledeiMac-2:~ apple$ docker --version
Docker version 18.09.2, build 6247962
AppledeiMac-2:~ apple$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01

1.3 Go Programming Language

Hyperledger Fabric uses the Go Programming Language for many of its components.
Go version 1.12.x is required.

采用菜鸟教程:Go语言环境安装
下载对应安装包–执行安装,安装后的路径 /usr/local/go

添加go相关的环境变量:

# 打开配置文件
sudo vi ~/.bash_profile
# 添加环境变量
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# 保存配置
esc -- :wq

1.4 Node.js Runtime and NPM

If you will be developing applications for Hyperledger Fabric leveraging the Hyperledger Fabric SDK for Node.js, you will need to have version 8.9.x of Node.js installed.

之前装过,验证安装结果:

AppledeiMac-2:~ apple$ node -v
v10.15.0
AppledeiMac-2:~ apple$ npm -v
6.4.1

1.5 Python

MacOS自带有Python 2.7,验证:

AppledeiMac-2:~ apple$ python --version
Python 2.7.10

2 安装示例,二进制和镜像

# 切换到当前苹果用户目录下
cd /Users/apple# 使用cURL(注意此处使用的https与文档不同)
curl -sSL https://bit.ly/2ysbOFE | bash -s

3 BYFN

cd fabric-samples/first-network

3.0 help

Usage:
byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-v]"<mode> - one of 'up', 'down', 'restart', 'generate' or 'upgrade'"- 'up' - bring up the network with docker-compose up"- 'down' - clear the network with docker-compose down"- 'restart' - restart the network"- 'generate' - generate required certificates and genesis block"- 'upgrade'  - upgrade the network from version 1.3.x to 1.4.0"-c <channel name> - channel name to use (defaults to \"mychannel\")"-t <timeout> - CLI timeout duration in seconds (defaults to 10)"-d <delay> - delay duration in seconds (defaults to 3)"-f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"-s <dbtype> - the database backend to use: goleveldb (default) or couchdb"-l <language> - the chaincode language: golang (default), node, or java"-o <consensus-type> - the consensus-type of the ordering service: solo (default), kafka, or etcdraft"-i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"-v - verbose mode"
byfn.sh -h (print this message)"Typically, one would first generate the required certificates and
genesis block, then bring up the network. e.g.:"byfn.sh generate -c mychannel"byfn.sh up -c mychannel -s couchdb"byfn.sh up -c mychannel -s couchdb -i 1.4.0"byfn.sh up -l node"byfn.sh down -c mychannel"byfn.sh upgrade -c mychannel"Taking all defaults:"byfn.sh generate"byfn.sh up"byfn.sh down"

3.1 generate

./byfn.sh generate

3.2 up

bring the network up with one of the following commands:

./byfn.sh up
The above command will compile Golang chaincode images and spin up the corresponding containers. Go is the default chaincode language, however there is also support for Node.js and Java chaincode. If you’d like to run through this tutorial with node chaincode, pass the following command instead:# we use the -l flag to specify the chaincode language
# forgoing the -l flag will default to Golang./byfn.sh up -l node
NoteFor more information on the Node.js shim, please refer to its documentation.NoteFor more information on the Java shim, please refer to its documentation.Тo make the sample run with Java chaincode, you have to specify -l java as follows:./byfn.sh up -l java
NoteDo not run both of these commands. Only one language can be tried unless you bring down and recreate the network between.In addition to support for multiple chaincode languages, you can also issue a flag that will bring up a five node Raft ordering service or a Kafka ordering service instead of the one node Solo orderer. For more information about the currently supported ordering service implementations, check out The Ordering Service.To bring up the network with a Raft ordering service, issue:./byfn.sh up -o etcdraft
To bring up the network with a Kafka ordering service, issue:./byfn.sh up -o kafka

显示下面结果时表示执行成功:

3.3 down

停掉该网络

./byfn.sh down

MacOS下搭建Fabric开发环境相关推荐

  1. macOS下GDAL Java开发环境搭建

    文章目录 macOS下GDAL Java开发环境搭建 GDAL源码编译安装 Maven安装本地JAR 使用Java版GDAL示例 版权声明:本文为博主原创文章,转载请注明原文出处! 写作时间:2020 ...

  2. MacOS Brew搭建PHP开发环境

    MacOS Brew搭建PHP开发环境 MacOS Brew搭建PHP开发环境 HomeBrew 包管理器安装 一.安装Nginx 二.安装PHP 三.安装MySQL 四.配置Nginx 五.安装Co ...

  3. Eclipse下搭建GitHub开发环境

    自从GitHub的强大性被开发者认识到后,越来越多的开发者选择使用GitHub代替SVN来进行开发.本人也不例外,最近开始研究如何使用GitHub来托管自己的代码,下面就开始介绍如何在Eclipse下 ...

  4. windows环境下搭建rabbitMQ开发环境

    2019独角兽企业重金招聘Python工程师标准>>> windows环境下搭建rabbitMQ开发环境 1.下载与安装 erlang rabbitmq 是使用erlang语言开发的 ...

  5. 在Windows环境下搭建Android开发环境

    标题:在Windows环境下搭建 Android 开发环境 作者:CrazyPebble 时间:2011年2月28日 声明:此文在参考其他网上资料以及笔者实践总结写下,一来自己可以做一些总结,二来给跟 ...

  6. mysql环境搭载后老出错_使用Docker在window10下搭建SWOFT开发环境,mysql连接错误

    使用Docker在window10下搭建SWOFT开发环境,mysql连接错误 { "code": 0, "error": "(Swoft\\Db\\ ...

  7. Windows下搭建ESP-IDF开发环境,适合ESP32/S2/C3/S3系列模组二次开发

    前言 本教程适用于以下两种用户: ①无Linux环境搭建经验或搭建Linux开发环境不成功: ②使用安信可windows一体化环境IDE V1.5开发环境搭建不成功: 本教程提供了windows下搭建 ...

  8. ubuntu下搭建android开发环境(转载)

    在ubuntu下搭建android开发环境,准备学习一下android开发. 1.安装JDK        首先到oracle的官网上下载linux版本的JDK(网址为:http://www.orac ...

  9. Windows10 下搭建汇编语言开发环境( 利用 DOSBOX 和 MASM32 )

    Windows10下搭建汇编语言开发环境(利用DOSBOX和MASM32):https://www.cnblogs.com/zyever/p/7919007.html 如何在win10 64位下搭载汇 ...

  10. iis7 mysql_windows 7 下搭建php开发环境(windows7+IIS7+php+mysql)

    首先需要说明的是,基于IIS v6.0/v7.0(2008),可以支持的脚本相当完整,不仅支持Linux无法支持的asp/asp.net,还可以安装php.mysql.zend实现php环境.同时,利 ...

最新文章

  1. ASP.NET专题研究——角色和Profile
  2. java 阻塞队列 LinkedBlockingQueue ArrayBlockingQueue 分析
  3. jenkins 增量发布插件_CI/CD工具:Jenkins还是GitLab CI/CD?
  4. css align-items的测试
  5. java验证码的代码_java实用验证码的实现代码
  6. 如何将本地代码推送至远程仓库
  7. python面向对象怎么解决_Python面向对象编程1
  8. openstack开发_在OpenStack开发中有效使用指标
  9. 论文赏析[NAACL19]无监督循环神经网络文法 (URNNG)
  10. ftp改为sftp_ftp自动传输软件,ftp自动传输软件使用方法详细介绍
  11. win7启动任务管理器快捷键
  12. 【项目实训】七牛云测试域名过期后所能采用的方法
  13. 海康威视接口在线调试
  14. openwrt开启网络共享Samba
  15. 大数据all_in环境搭建
  16. python判断今天周几_python 如何判断当天为周几?判断当天是否为工作日?
  17. 2021中国IC封装基板市场现状及未来发展趋势
  18. VVC学习之四:VTM中的数据结构——CodingUnit、PredictionUnit、TransformUnit
  19. 网站被百度降权后快速恢复权重和收录的几个方法
  20. Tivaware中MAP前缀函数与ROM前缀函数的区别

热门文章

  1. 通过密钥 SFTP(一)
  2. 【Flutter】Dart中的Mixins混入你知道是什么吗?
  3. React进行服务器端数据请求---fetch
  4. Dynamic Multipoint ***(DM***)
  5. C# XmlReader
  6. php5 相关软件下载
  7. 苹果mac文本处理软件:FSNotes
  8. 苹果Mac鼠标光标丢失如何找回?
  9. 如何使用MacClean在Mac上释放磁盘空间?
  10. rcmd–App Switcher for Mac快速切换应用程序