Please install the Prerequisites before following these install instructions.
We think the best way to understand something is to use it yourself. To help you use Fabric, we have created a simple Fabric test network using Docker compose, and a set of sample applications that demonstrate its core capabilities.
We also have precompiled Fabric CLI tool binaries and Fabric Docker Images which will be downloaded to your environment, to get you going.
The install-fabric.sh script introduced in the next section automates the process to set up your environment. Specifically, it performs the following steps:
- Clones the hyperledger/fabric-samples repository.
- Downloads the latest Hyperledger Fabric Docker images and tags them as
latest - Downloads the following platform-specific Hyperledger Fabric CLI tool binaries and config files into the
fabric-samples/binand/configdirectories. These binaries will help you interact with the test network.configtxgen,configtxlator,cryptogen,discover,ledgerutil,orderer,osnadmin,peer,fabric-ca-client,fabric-ca-server
For most users who want a working local Fabric environment with a single script, the recommended path is:
- Install the required software from Prerequisites.
- Run
install-fabric.shto download the Fabric binaries, Docker images, and optionallyfabric-samples. - Use the
fabric-samplestest network and tutorials to start a local network and deploy chaincode.
If you want to contribute to Fabric itself, use this install flow first and then continue with the contributor development environment, which adds the extra tools and steps needed to build Fabric and run its test suites.
A working directory is required - for example, Go Developers use the $HOME/go/src/github.com/<your_github_userid> directory. This is a Golang Community recommendation for Go projects.
mkdir -p $HOME/go/src/github.com/<your_github_userid>
cd $HOME/go/src/github.com/<your_github_userid>To get the install script:
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.shRun the script with the -h option to see the options:
./install-fabric.sh -h
Usage: ./install-fabric.sh [-f|--fabric-version <arg>] [-c|--ca-version <arg>] <comp-1> [<comp-2>] ... [<comp-n>] ...
<comp>: Component to install one or more of d[ocker]|b[inary]|s[amples]. If none specified, all will be installed
-f, --fabric-version: FabricVersion (default: '2.5.15')
-c, --ca-version: Fabric CA Version (default: '1.5.17')To specify the components to download add one or more of the following arguments. Each argument can be shortened to its first letter.
dockerto use Docker to download the Fabric Container Imagespodmanto use podman to download the Fabric Container Imagesbinaryto download the Fabric binariessamplesto clone the fabric-samples github repo to the current directory
To pull the Docker containers and clone the samples repo, run one of these commands for example
./install-fabric.sh docker samples binary
or
./install-fabric.sh d s bIf no arguments are supplied, then the arguments docker binary samples are assumed.
By default the latest version of the components are used; these can be altered by using the options --fabric-version and -ca-version. -f and -c are the respective short forms.
For example, to download the v2.5.15 binaries, run this command
./install-fabric.sh --fabric-version 2.5.15 binaryYou have completed installing Fabric samples, Docker images, and binaries to your system.
- If you are looking to set up your environment to start contributing to Fabric, please refer to the instructions for Setting up the contributor development environment.
Note: this is an updated install script with the same end-result as the existing script, but with an improved syntax. This script adopts the positive opt-in approach to selecting the components to install. The original script is still present at the same location
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh| bash -s
- If you need help, post your questions and share your logs on the fabric-questions channel on Hyperledger Discord Chat or on StackOverflow.