Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install the Hyperledger Fabric development environment

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install the Hyperledger Fabric development environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Hyperledger Fabric development environment installation is not too complicated, just follow the steps of this article, I believe it will be possible.

1. Install Docker (Community Edition) on Ubuntu 16.04

First update the apt index in the following ways:

Sudo apt-get update

Add the official GPG key for Docker:

Curl-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add-

Add the Docker repository to the APT source, and the Docker repository has three architecture-based packages:

AMD64 (64-bit architecture package):

Sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable"

ARMHF (32-bit architecture, that is, software packages based on ARM-86 architecture):

Sudo add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable"

The third version of this package is the S390X version, which applies only to z-kernel-based Linux:

Sudo add-apt-repository "deb [arch=s390x] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable"

Now update the apt index with the newly added repo:

Sudo apt-get update

Now install from the repo of Docker:

Apt-cache policy docker-ce

Now install Docker:

Sudo apt-get install-y docker-ce

Now check the status of the Docker engine:

Sudo systemctl status docker

Run docker without sudo:

1.sudo groupadd docker

B.sudo gpasswd-a $USER docker

c. Either execute newgrp docker or log out and log back in.

two。 Install Docker Compose on Ubuntu 16.04

First update the apt index in the following ways:

Sudo apt-get update

Install Docker Compose on the Linux system:

Sudo curl-L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname-s`-`uname-m`-o / usr/local/bin/docker-compose

Then run to apply executable permissions to the downloaded binaries:

Sudo chmod + x / usr/local/bin/docker-compose

Check the version of Docker Compose:

Docker-compose version3. Install the GO programming language:

First update the apt index in the following ways:

Sudo apt-get update

We need version 1.9.x of the Go programming language because Hyperledge Fabric uses version 1.9.x of Go in most of its components to run the following command:

Cd ~

If your Ubuntu is based on x86 architecture, run

Curl-O https://storage.googleapis.com/golang/go1.9.linux-386.tar.gz

Otherwise, if your Ubuntu is based on the x64 architecture, run:

Curl-O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz

Then use the following command to extract:

If you download the 32-bit / x86 version

Tar xvf go1.9.linux-386.tar.gz

Or if you download the 64-bit / x64 version

Tar xvf go1.9.linux-amd64.tar.gz

Now change the ownership of the extracted go folder to root:root

Sudo chown-R root:root. / go

Now move the go folder to the / usr/local directory

Sudo mv go / usr/local

Set the execution path:

Cd ~ sudo nano .bashrc

Now add these lines at the end of the file before you do this, make sure that go (that is, the moved go folder) is installed in / usr/local/directory_.

Export GOPATH=$HOME/myworkspaceexport PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Now load the latest updated bashrc

Source .bashrc

Now, create a workspace directory and place the Go project in it

Mkdir $home/myworkspace

Now create a project directory

Mkdir-p myworkspace/src/github.com/go_project/hello

Now create a hello world program go file in the hello directory under the go_ project directory

Nano ~ / myworkspace/src/github.com/go_project/hello/hello.go

Copy the following code

Package main import "fmt" func main () {fmt.Printf ("hello, world\ n")}

Now save it as hello.go, you can name your program with a valid naming convention, but the .go extension is very important.

Now run the following command to install the Go program:

Go install github.com/go_project/hello

Now compile it and run it

Hello

This should be output as follows:

Hello, world!

Congratulations! You have successfully installed the Go programming language on the Linux system.

4. Install node.js:

Before installing node.js, let's install nvm, which allows us to install specific versions of nodes on the machine, and it also allows us to download and manage multiple versions of nodes on the same machine to download nvm:

Curl-O-https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Or

Wget-qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Now install node v6.11.2 and use this version of node very carefully as required by the hyprledger structure.

Nvm install 6.11.2

Now, you can check the version of the node to be installed (specifically V6.11.2), because we have installed it:

Node-version

The installation node will eventually install NPM with it, so now verify the version of NPM, which should be 3.10.10:

Npm-v

If version 3.10.10 of NPM is not available on the system, run:

Npm install npm@3.10.10-G5. Install python:

Because Ubuntu comes with python3.5.1 as a python3 binary. Hyperledge Fabric requires python 2.7 for npm install to work properly, so to install pyhton2.7, run the following command:

Sudo apt-get install python-y

Check the version of python

Python-- version6. Install GIT:sudo apt-get install git7. Set Hyperledger structure: cd ~ mkdir hyperledger-binariescd hyperledger-binaries/

Now let's set up our machne to actually run a hyperledger structure, run the following command to download the docker image and mark it as up-to-date, and download the structure binary, and run it from the location where you want to extract the structure binary:

Curl-sSL https://goo.gl/6wtTN5 | bash-s 1.1.0

Now add the download location of these binaries to the system path

Cd ~ sudo nano .bashrcexport FABRICPATH=$HOME/hyperledger-binaries/fabric-samplesexport PATH=$PATH:$FABRICPATH/binsource .bashrc

Now, let's run this example to test whether your complete settings are working properly with the sample structured network:

Cd fabric-samples/first-network

Now to generate the CA certificate and Docker to write the end-to-end configuration file, run:

. / byfn.sh-m generate

Now you want to actually start the network and install the sample chain code on each peer side of the structure:

. / byfn.sh-m up

Now run the following command to see if all docker images are running in conatiners:

Docker ps

Congratulations, you have successfully established the fabric network.

Now stop and tear up the fabric:

. / byfn.sh-m down Thank you for reading this article carefully. I hope the article "how to install the Hyperledger Fabric Development Environment" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report