Windows怎么安装Hyperledger-fabric
本篇内容主要讲解“Windows怎么安装Hyperledger-fabric”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Windows怎么安装Hyperledger-fabric”吧!
创新互联公司是一家专注于成都做网站、网站制作与策划设计,桃江网站建设哪家好?创新互联公司做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:桃江等地区。桃江做网站价格咨询:028-86922220
在正式安装Hyperledger之前,应确保之前的环境都已经安装完毕,如没有安装完毕的话,可以参考这里。
1. 下载 Hyperledger 官方提供的配置文件
由于该文件位于墙外,所以本文提供了该文件(bootstrap.sh)对应的详细脚本内容。
该脚本主要包括三个步骤,分别如下
从 Hyperledger 克隆 hyperledger fabric示例代码
从 Hyper ledger 仓库拉取可执行命令文件
通过docker 拉取 hyperledger镜像
引用文件 - bootstrap.sh
#!/bin/bash # # Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # # if version not passed in, default to latest released version VERSION=2.3.1 # if ca version not passed in, default to latest released version CA_VERSION=1.4.9 ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')") MARCH=$(uname -m) printHelp() { echo "Usage: bootstrap.sh [version [ca_version]] [options]" echo echo "options:" echo "-h : this help" echo "-d : bypass docker image download" echo "-s : bypass fabric-samples repo clone" echo "-b : bypass download of platform-specific binaries" echo echo "e.g. bootstrap.sh 2.3.1 1.4.9 -s" echo "will download docker images and binaries for Fabric v2.3.1 and Fabric CA v1.4.9" } # dockerPull() pulls docker images from fabric and chaincode repositories # note, if a docker image doesn't exist for a requested release, it will simply # be skipped, since this script doesn't terminate upon errors. dockerPull() { #three_digit_image_tag is passed in, e.g. "1.4.7" three_digit_image_tag=$1 shift #two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references to most recent baseos, ccenv, javaenv, nodeenv patch releases two_digit_image_tag=$(echo "$three_digit_image_tag" | cut -d'.' -f1,2) while [[ $# -gt 0 ]] do image_name="$1" echo "====> hyperledger/fabric-$image_name:$three_digit_image_tag" docker pull "hyperledger/fabric-$image_name:$three_digit_image_tag" docker tag "hyperledger/fabric-$image_name:$three_digit_image_tag" "hyperledger/fabric-$image_name" docker tag "hyperledger/fabric-$image_name:$three_digit_image_tag" "hyperledger/fabric-$image_name:$two_digit_image_tag" shift done } cloneSamplesRepo() { # clone (if needed) hyperledger/fabric-samples and checkout corresponding # version to the binaries and docker images to be downloaded if [ -d first-network ]; then # if we are in the fabric-samples repo, checkout corresponding version echo "==> Already in fabric-samples repo" elif [ -d fabric-samples ]; then # if fabric-samples repo already cloned and in current directory, # cd fabric-samples echo "===> Changing directory to fabric-samples" cd fabric-samples else echo "===> Cloning hyperledger/fabric-samples repo" git clone -b main https://github.com/hyperledger/fabric-samples.git && cd fabric-samples fi if GIT_DIR=.git git rev-parse v${VERSION} >/dev/null 2>&1; then echo "===> Checking out v${VERSION} of hyperledger/fabric-samples" git checkout -q v${VERSION} else echo "fabric-samples v${VERSION} does not exist, defaulting main" git checkout -q main fi } # This will download the .tar.gz download() { local BINARY_FILE=$1 local URL=$2 echo "===> Downloading: " "${URL}" curl -L --retry 5 --retry-delay 3 "${URL}" | tar xz || rc=$? if [ -n "$rc" ]; then echo "==> There was an error downloading the binary file." return 22 else echo "==> Done." fi } pullBinaries() { echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries" download "${BINARY_FILE}" "https://github.com/hyperledger/fabric/releases/download/v${VERSION}/${BINARY_FILE}" if [ $? -eq 22 ]; then echo echo "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----" echo exit fi echo "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary" download "${CA_BINARY_FILE}" "https://github.com/hyperledger/fabric-ca/releases/download/v${CA_VERSION}/${CA_BINARY_FILE}" if [ $? -eq 22 ]; then echo echo "------> ${CA_TAG} fabric-ca-client binary is not available to download (Available from 1.1.0-rc1) <----" echo exit fi } pullDockerImages() { command -v docker >& /dev/null NODOCKER=$? if [ "${NODOCKER}" == 0 ]; then FABRIC_IMAGES=(peer orderer ccenv tools) case "$VERSION" in 2.*) FABRIC_IMAGES+=(baseos) shift ;; esac echo "FABRIC_IMAGES:" "${FABRIC_IMAGES[@]}" echo "===> Pulling fabric Images" dockerPull "${FABRIC_TAG}" "${FABRIC_IMAGES[@]}" echo "===> Pulling fabric ca Image" CA_IMAGE=(ca) dockerPull "${CA_TAG}" "${CA_IMAGE[@]}" echo "===> List out hyperledger docker images" docker images | grep hyperledger else echo "=========================================================" echo "Docker not installed, bypassing download of Fabric images" echo "=========================================================" fi } DOCKER=true SAMPLES=true BINARIES=true # Parse commandline args pull out # version and/or ca-version strings first if [ -n "$1" ] && [ "${1:0:1}" != "-" ]; then VERSION=$1;shift if [ -n "$1" ] && [ "${1:0:1}" != "-" ]; then CA_VERSION=$1;shift if [ -n "$1" ] && [ "${1:0:1}" != "-" ]; then THIRDPARTY_IMAGE_VERSION=$1;shift fi fi fi # prior to 1.2.0 architecture was determined by uname -m if [[ $VERSION =~ ^1\.[0-1]\.* ]]; then export FABRIC_TAG=${MARCH}-${VERSION} export CA_TAG=${MARCH}-${CA_VERSION} export THIRDPARTY_TAG=${MARCH}-${THIRDPARTY_IMAGE_VERSION} else # starting with 1.2.0, multi-arch images will be default : "${CA_TAG:="$CA_VERSION"}" : "${FABRIC_TAG:="$VERSION"}" : "${THIRDPARTY_TAG:="$THIRDPARTY_IMAGE_VERSION"}" fi BINARY_FILE=hyperledger-fabric-${ARCH}-${VERSION}.tar.gz CA_BINARY_FILE=hyperledger-fabric-ca-${ARCH}-${CA_VERSION}.tar.gz # then parse opts while getopts "h?dsb" opt; do case "$opt" in h|\?) printHelp exit 0 ;; d) DOCKER=false ;; s) SAMPLES=false ;; b) BINARIES=false ;; esac done if [ "$SAMPLES" == "true" ]; then echo echo "Clone hyperledger/fabric-samples repo" echo cloneSamplesRepo fi if [ "$BINARIES" == "true" ]; then echo echo "Pull Hyperledger Fabric binaries" echo pullBinaries fi if [ "$DOCKER" == "true" ]; then echo echo "Pull Hyperledger Fabric docker images" echo pullDockerImages fi
2. 执行 bootstrap.sh 脚本
由于该脚本属于linux下的命令脚本,因此无法通过Windows shell执行,但是可以通过Git bash执行,具体执行命令如下。
favccxx@DESKTOP-83S72O9 MINGW64 /f/dev/example $ chmod 777 bootstrap.sh favccxx@DESKTOP-83S72O9 MINGW64 /f/dev/example $ ./bootstrap.sh Clone hyperledger/fabric-samples repo ===> Cloning hyperledger/fabric-samples repo Cloning into 'fabric-samples'... remote: Enumerating objects: 9, done. remote: Counting objects: 100% (9/9), done. remote: Compressing objects: 100% (9/9), done. Receiving objremote: Total 7458 (delta 2), reused 2 (delta 0), pack-reused 7449 Receiving objects: 100% (7458/7458), 4.27 MiB | 1.12 MiB/s, done. Resolving deltas: 100% (3874/3874), done. fabric-samples v2.3.1 does not exist, defaulting main Pull Hyperledger Fabric binaries ===> Downloading version 2.3.1 platform specific fabric binaries ===> Downloading: https://github.com/hyperledger/fabric/releases/download/v2.3.1/hyperledger-fabric-windows-amd64-2.3.1.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 651 100 651 0 0 614 0 0:00:01 0:00:01 --:--:-- 614 100 73.5M 100 73.5M 0 0 702k 0 0:01:47 0:01:47 --:--:-- 840k ==> Done. ===> Downloading version 1.4.9 platform specific fabric-ca-client binary ===> Downloading: https://github.com/hyperledger/fabric-ca/releases/download/v1.4.9/hyperledger-fabric-ca-windows-amd64-1.4.9.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 654 100 654 0 0 781 0 --:--:-- --:--:-- --:--:-- 780 100 19.1M 100 19.1M 0 0 1131k 0 0:00:17 0:00:17 --:--:-- 1255k ==> Done. Pull Hyperledger Fabric docker images FABRIC_IMAGES: peer orderer ccenv tools baseos ===> Pulling fabric Images ====> hyperledger/fabric-peer:2.3.1 2.3.1: Pulling from hyperledger/fabric-peer 801bfaa63ef2: Pulling fs layer e7f20c07c51b: Pulling fs layer bb00588ab247: Pulling fs layer 8a823a5e7999: Pulling fs layer 9308132a1c76: Pulling fs layer 84d74acbd352: Pulling fs layer 84d74acbd352: Waiting 9308132a1c76: Waiting 8a823a5e7999: Waiting bb00588ab247: Verifying Checksum bb00588ab247: Download complete e7f20c07c51b: Verifying Checksum e7f20c07c51b: Download complete 9308132a1c76: Verifying Checksum 9308132a1c76: Download complete 801bfaa63ef2: Verifying Checksum 801bfaa63ef2: Download complete 801bfaa63ef2: Pull complete e7f20c07c51b: Pull complete bb00588ab247: Pull complete 84d74acbd352: Verifying Checksum 84d74acbd352: Download complete 8a823a5e7999: Verifying Checksum 8a823a5e7999: Download complete 8a823a5e7999: Pull complete 9308132a1c76: Pull complete 84d74acbd352: Pull complete Digest: sha256:d5f302545f71dbf83d172dd5ec2d1106db7ac77883c67b4d72b23c801bcf16fc Status: Downloaded newer image for hyperledger/fabric-peer:2.3.1 docker.io/hyperledger/fabric-peer:2.3.1 ====> hyperledger/fabric-orderer:2.3.1 2.3.1: Pulling from hyperledger/fabric-orderer 801bfaa63ef2: Already exists e7f20c07c51b: Already exists 400c127a54db: Pulling fs layer 7d6bb7272303: Pulling fs layer 745ed752c905: Pulling fs layer 1f9702d08456: Pulling fs layer 44ee6b99c7df: Pulling fs layer 1f9702d08456: Waiting 44ee6b99c7df: Waiting 745ed752c905: Verifying Checksum 745ed752c905: Download complete 400c127a54db: Verifying Checksum 400c127a54db: Download complete 400c127a54db: Pull complete 44ee6b99c7df: Verifying Checksum 44ee6b99c7df: Download complete 1f9702d08456: Verifying Checksum 1f9702d08456: Download complete 7d6bb7272303: Download complete 7d6bb7272303: Pull complete 745ed752c905: Pull complete 1f9702d08456: Pull complete 44ee6b99c7df: Pull complete Digest: sha256:635a7fb0b0227a59ee07bb21c0c719d952b6f1c9da6cd5eaf449e6e3f39aafcd Status: Downloaded newer image for hyperledger/fabric-orderer:2.3.1 docker.io/hyperledger/fabric-orderer:2.3.1 ====> hyperledger/fabric-ccenv:2.3.1 2.3.1: Pulling from hyperledger/fabric-ccenv 188c0c94c7c5: Pulling fs layer 0ef7d3d256c8: Pulling fs layer de9db76c5a1d: Pulling fs layer a99aea8d7e66: Pulling fs layer a5124c9860dc: Pulling fs layer 0e91c50f714f: Pulling fs layer a0ebc98ad666: Pulling fs layer 2139fe33a27c: Pulling fs layer f22d7e155f9b: Pulling fs layer a99aea8d7e66: Waiting a5124c9860dc: Waiting 0e91c50f714f: Waiting a0ebc98ad666: Waiting 2139fe33a27c: Waiting f22d7e155f9b: Waiting de9db76c5a1d: Verifying Checksum de9db76c5a1d: Download complete 0ef7d3d256c8: Verifying Checksum 0ef7d3d256c8: Download complete a5124c9860dc: Verifying Checksum a5124c9860dc: Download complete 188c0c94c7c5: Download complete 188c0c94c7c5: Pull complete 0ef7d3d256c8: Pull complete de9db76c5a1d: Pull complete a0ebc98ad666: Verifying Checksum a0ebc98ad666: Download complete 2139fe33a27c: Verifying Checksum 2139fe33a27c: Download complete f22d7e155f9b: Verifying Checksum f22d7e155f9b: Download complete 0e91c50f714f: Verifying Checksum 0e91c50f714f: Download complete a99aea8d7e66: Download complete a99aea8d7e66: Pull complete a5124c9860dc: Pull complete 0e91c50f714f: Pull complete a0ebc98ad666: Pull complete 2139fe33a27c: Pull complete f22d7e155f9b: Pull complete Digest: sha256:881ebe5a56e2424431a073e1ba518f47b1bd7117ab12f0296c5fe465dcf72504 Status: Downloaded newer image for hyperledger/fabric-ccenv:2.3.1 docker.io/hyperledger/fabric-ccenv:2.3.1 ====> hyperledger/fabric-tools:2.3.1 2.3.1: Pulling from hyperledger/fabric-tools 188c0c94c7c5: Already exists 0ef7d3d256c8: Already exists de9db76c5a1d: Already exists a99aea8d7e66: Already exists a5124c9860dc: Already exists e7b57d412333: Pulling fs layer 04a826e76290: Pulling fs layer c53dc52418de: Pulling fs layer c53dc52418de: Download complete e7b57d412333: Verifying Checksum e7b57d412333: Download complete e7b57d412333: Pull complete 04a826e76290: Verifying Checksum 04a826e76290: Download complete 04a826e76290: Pull complete c53dc52418de: Pull complete Digest: sha256:2fed59de66c3ad34b70e3abb644789b0fd8c66edc8be9fa624313fc2d366c6a2 Status: Downloaded newer image for hyperledger/fabric-tools:2.3.1 docker.io/hyperledger/fabric-tools:2.3.1 ====> hyperledger/fabric-baseos:2.3.1 2.3.1: Pulling from hyperledger/fabric-baseos 801bfaa63ef2: Already exists e7f20c07c51b: Already exists e7ffd743a43f: Pulling fs layer e7ffd743a43f: Verifying Checksum e7ffd743a43f: Download complete e7ffd743a43f: Pull complete Digest: sha256:4e35a94544f68e05598a499c36ac7bb1a73d7eaacfb0c8973c0f822f87224720 Status: Downloaded newer image for hyperledger/fabric-baseos:2.3.1 docker.io/hyperledger/fabric-baseos:2.3.1 ===> Pulling fabric ca Image ====> hyperledger/fabric-ca:1.4.9 1.4.9: Pulling from hyperledger/fabric-ca b8f262c62ec6: Pulling fs layer db9dbc6799b3: Pulling fs layer 9c5c884a6020: Pulling fs layer 370868734ec0: Pulling fs layer cbce57ae4cad: Pulling fs layer fc00299dbf2c: Pulling fs layer a1e42212f1ce: Pulling fs layer add0e148da22: Pulling fs layer 370868734ec0: Waiting cbce57ae4cad: Waiting fc00299dbf2c: Waiting a1e42212f1ce: Waiting add0e148da22: Waiting db9dbc6799b3: Verifying Checksum db9dbc6799b3: Download complete 370868734ec0: Download complete 9c5c884a6020: Verifying Checksum 9c5c884a6020: Download complete cbce57ae4cad: Verifying Checksum cbce57ae4cad: Download complete fc00299dbf2c: Verifying Checksum fc00299dbf2c: Download complete add0e148da22: Verifying Checksum add0e148da22: Download complete a1e42212f1ce: Verifying Checksum a1e42212f1ce: Download complete b8f262c62ec6: Verifying Checksum b8f262c62ec6: Pull complete db9dbc6799b3: Pull complete 9c5c884a6020: Pull complete 370868734ec0: Pull complete cbce57ae4cad: Pull complete fc00299dbf2c: Pull complete a1e42212f1ce: Pull complete add0e148da22: Pull complete Digest: sha256:28f50c6aa4f4642842e706d3ae6dcee181921d03bd30ab2a8b09b66e0349d92f Status: Downloaded newer image for hyperledger/fabric-ca:1.4.9 docker.io/hyperledger/fabric-ca:1.4.9 ===> List out hyperledger docker images yeasy/hyperledger-fabric latest 9150d9d58622 5 weeks ago 2.34GB hyperledger/fabric-tools 2.3 d3f075ceb6c6 2 months ago 454MB hyperledger/fabric-tools 2.3.1 d3f075ceb6c6 2 months ago 454MB hyperledger/fabric-tools latest d3f075ceb6c6 2 months ago 454MB hyperledger/fabric-peer 2.3 1e8e82ab49af 2 months ago 56.5MB hyperledger/fabric-peer 2.3.1 1e8e82ab49af 2 months ago 56.5MB hyperledger/fabric-peer latest 1e8e82ab49af 2 months ago 56.5MB hyperledger/fabric-orderer 2.3 12f8ed297e92 2 months ago 39.6MB hyperledger/fabric-orderer 2.3.1 12f8ed297e92 2 months ago 39.6MB hyperledger/fabric-orderer latest 12f8ed297e92 2 months ago 39.6MB hyperledger/fabric-ccenv 2.3 55dda4b263f6 2 months ago 502MB hyperledger/fabric-ccenv 2.3.1 55dda4b263f6 2 months ago 502MB hyperledger/fabric-ccenv latest 55dda4b263f6 2 months ago 502MB hyperledger/fabric-baseos 2.3 fb85a21d6642 2 months ago 6.85MB hyperledger/fabric-baseos 2.3.1 fb85a21d6642 2 months ago 6.85MB hyperledger/fabric-baseos latest fb85a21d6642 2 months ago 6.85MB hyperledger/fabric-ca 1.4 dbbc768aec79 6 months ago 158MB hyperledger/fabric-ca 1.4.9 dbbc768aec79 6 months ago 158MB hyperledger/fabric-ca latest dbbc768aec79 6 months ago 158MB
1. 下载hyperledger示例文件
$ git clone https://github.com/hyperledger/fabric-samples Cloning into 'fabric-samples'... remote: Enumerating objects: 44, done. remote: Counting objects: 100% (44/44), done. remote: Compressing objects: 100% (33/33), done. remote: Total 7458 (delta 10), reused 37 (delta 8), pack-reused 7414 Receiving objects: 100% (7458/7458), 4.28 MiB | 1.06 MiB/s, done. Resolving deltas: 100% (3856/3856), done.
2. 下载 hyperledger-fabric 镜像
C:\Users\favccxx>docker search hyperledger-fabric NAME DESCRIPTION STARS OFFICIAL AUTOMATED yeasy/hyperledger-fabric Docker image for Hyperledger Fabric. 12 [OK] yeasy/hyperledger-fabric-peer Docker image for Hyperledger Fabric Peer 7 [OK] yeasy/hyperledger-fabric-base Docker image for hyperledger fabric base. 6 [OK] yeasy/hyperledger-fabric-orderer Docker image for Hyperledger Fabric Orderer 3 [OK] yeasy/hyperledger-fabric-ca Docker image for Hyperledger fabric-ca. 2 [OK] yeasy/hyperledger-fabric-cop Docker image for the Hyperledger Fabric-Cop 2 [OK] yeasy/hyperledger-fabric-kafka Docker image for Hyperledger Fabric Kafka. 1 [OK] yeasy/hyperledger-fabric-membersrvc Docker image for Hyperledger Fabric Membersr… 1 [OK] yeasy/hyperledger-fabric-couchdb Docker image for Hyperledger Fabric Couchdb 1 [OK] yeasy/hyperledger-fabric-sdk-node Hyperledger Fabric SDK Node 0 [OK] crazybit/hyperledger-fabric-peer hyperledger-fabric-peer 0 [OK] crazybit/hyperledger-fabric-orderer hyperledger-fabric-orderer 0 [OK] nicolaspence/hyperledger-fabric-couchdb 0 crazybit/hyperledger-fabric-base fabric base image 0 [OK] downthefallline/hyperledger-fabric-couchdb 0 jincort/hyperledger-fabricapi 0 vpispanen/hyperledger-fabric-1.4-updated hyperledger fabric 1.4 with java 11 and grad… 0 xingangw/hyperledger-fabric-orderer 0 iwita/hyperledger-fabric-peer 0 amawi/hyperledger-fabric-tools hyperledger-fabric-tools 0 wingdevelop/hyperledger-fabric-tools hyperledger-fabric-tools including configtxl… 0 tricle/hyperledger-fabric-buildenv 0 iwita/hyperledger-fabric-tools 0 downthefallline/hyperledger-fabric-cli 0 downthefallline/hyperledger-fabric-peer 0 C:\Users\favccxx>docker pull yeasy/hyperledger-fabric:latest latest: Pulling from yeasy/hyperledger-fabric 0ecb575e629c: Pull complete 7467d1831b69: Pull complete feab2c490a3c: Pull complete f15a0f46f8c3: Pull complete 2ea92ed63b96: Pull complete 223c5fc7af76: Pull complete 764ae8cdbfbc: Pull complete 48b0102f6708: Pull complete 66efff5eb9cb: Pull complete 56c1bfac88a2: Pull complete a7190ed30697: Pull complete a42da091ddaf: Pull complete 46cd834e6a98: Pull complete 336346de5934: Pull complete d697c1864fc7: Pull complete 8507db9c26de: Pull complete a0eda6690634: Pull complete d3ee5adb1ef2: Pull complete 985a95cc8f81: Pull complete c7ded885d9a7: Pull complete Digest: sha256:497381f310e9098951e32ef02bf6ee23fe93c762f2af76045074fa79857cd895 Status: Downloaded newer image for yeasy/hyperledger-fabric:latest
参考资料:https://hyperledger-fabric.readthedocs.io/en/latest/install.html
到此,相信大家对“Windows怎么安装Hyperledger-fabric”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
当前题目:Windows怎么安装Hyperledger-fabric
路径分享:http://pwwzsj.com/article/jocieo.html