Fabric v1.4.0 stand-alone installation and deployment
I. Pre-preparation
The installation of fabric s depends on the docker environment, so the premise is to install the docker well. At the same time, some software versions are required as follows:
- curl needs the latest version.
- Doker version 17.06 or more
- Doker-compose Version 1.14.0 or above
- go Version 1.11 and above
The operating system installed in this document is ubuntu. If it is centos, the basic environment is ready to switch to centos automatically. If you need video learning, you can refer to it. Video tutorial.
- Installation of the latest version of cURL
# Download the latest version of the cURL and unzip it wgethttps://curl.haxx.se/download/curl-7.65.3.tar.xz sudo tar xzvf curl-7.63.0.tar.gz -C /home # Compile and install cURL cd /home/curl-7.65.3 ./configure make sudo make install
Check the installation success by running curl --version.
-
Docker and Docker Compose Installation
- Docker
First uninstall old versions that may exist
- Docker
sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install apt-transport-https ca-certificates gnupg-agent software- properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
docker version checks for success
- Docker Compose
Download the Docker Compose binary
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod x /usr/local/bin/docker-compose ```
- Go installation
# Download go1.11.linux-amd64.tar.gz and extract it to the specified directory (here, / usr/local) wget https://studygolang.com/dl/golang/go1.11.linux-amd64.tar.gz tar xzvf go1.11.linux-amd64.tar.gz -C /usr/local goenvset.sh The contents of the file are as follows: cat >> /etc/profile << EOF export GOROOT=/usr/local/go export GOARCH=amd64 export GOOS=linux export GOPATH=/home/ubuntu/gopath export GOBIN=\$GOPATH/bin export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH EOF # Execute the existing goenvset.sh to write the corresponding environment variables to / etc/profile sudo chmod 705 goenvset.sh # Change the permissions of goenvset.sh to make it executable sudo ./goenvset.sh # Execute the goenvset.sh script # Enabling Environmental Variables source /etc/profile
Fabric Installation
- Download fabric-samples to the $GOPATH/src/github.com/hyperledger directory
mkdir -p $GOPATH/src/github.com/hyperledger cd $GOPATH/src/github.com/hyperledger # Clone fabric-samples project and switch to v1.4 tag git clone https://github.com/hyperledger/fabric-samples.git cd fabric-samples git checkout -b sample v1.4.0
- Install Fabric Binaries and Fabric-related Docker images
cd $GOPATH/src/github.com/hyperledger/fabric-samples/scripts # Install Fabric, Fabric-ca and third-party Docker images (. / bootstrap.sh < fabric > < fabric-ca > < thirdparty >) ./bootstrap.sh 1.4.0 1.4.0 0.4.14
It is worth noting that if the package is not successfully downloaded due to network problems, manual installation is required. Installation steps are as follows: if the following binary file is not downloaded, manual execution of commands
wget https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/linux-amd64-1.4.0/hyperledger-fabric-linux-amd64-1.4.0.tar.gz wget https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/linux-amd64-1.4.0/hyperledger-fabric-ca-linux-amd64-1.4.0.tar.gz tar xzvf hyperledger-fabric-linux-amd64-1.4.0.tar.gz -C $GOPATH/src/github.com/hyperledger/fabric-samples/ tar xzvf hyperledger-fabric-ca-linux-amd64-1.4.0.tar.gz -C $GOPATH/src/github.com/hyperledger/fabric-samples/ #Write environment variables to / etc/profile sudo echo 'export PATH=$GOPATH/src/github.com/hyperledger/fabric-samples/bin:$PATH' >> /etc/profile #Enabling Environmental Variables source /etc/profile
If the docker related image is not downloaded, the following command is executed to download the related image.
# Download Fabric-related mirrors (fabric-peer, fabric-orderer, fabric-ccenv, fabric-tools). Take fabric-peer mirrors as an example. Other mirrors are the same. docker pull hyperledger/fabric-peer:1.4.0 docker tag hyperledger/fabric-peer:1.4.0 hyperledger/fabric-peer:latest # Download Fabric third-party mirrors (fabric-couchdb, fabric-kafka, fabric-zookeeper), here take fabric-couchdb as an example, and the other mirrors are the same. docker pull hyperledger/fabric-couchdb:0.4.14 docker tag hyperledger/fabric-couchdb:0.4.14 hyperledger/fabric-couchdb:latest # Download Fabric CA Mirror docker pull hyperledger/fabric-ca:1.4.0 docker tag hyperledger/fabric-ca:1.4.0 hyperledger/fabric-ca:latest
- Test by running the Build your first network sample.
cd $GOPATH/src/github.com/hyperledger/fabric-samples/first-network # Compile chaincode developed through Golang and start related containers ./byfn.sh up ./byfn.sh up -l node ./byfn.sh up -o kafka #Stop all containers in the first-network network, delete crypto materials and four artifacts (genesis.block, mychannel.block, Org1MSPanchor.tx, Org2MSPanchor.tx) and chaincode images ./byfn.sh down
Reference material
- Hyperledger Fabric release-1.4 official manual
- Official docker tutorial( Get Docker CE for Ubuntu)