- It is always a smart idea not to use root to install these softwares. Let us create a new user.
sudo adduser <username>
- Now we need to add our user to the sudo group.
sudo usermod -aG sudo <username>
- Switch to our newly created user:
su <username>
- Test the sudo access
sudo ls
- Run below command to install Curl.
sudo apt-get install curl
- Verify the installation and check the version of Curl using below command.
curl --version
- Open the ubuntu terminal and run below command. This will start the installation for Git.
sudo apt-get install git
- Run below command to check if Git is successfully installed or not. This should return the version of Git.
git --version
- Install the latest version of Docker if it is not already installed.
sudo apt-get -y install docker-compose
- Run below command to check if docker and Docker Compose is successfully installed or not. This should return the version of it.
docker --version
docker-compose --version
- Make sure the Docker daemon is running.
sudo systemctl start docker
- Optional: If you want the Docker daemon to start when the system starts, use the following:
sudo systemctl enable docker
- Add your user to the Docker group.
sudo usermod -a -G docker <username>
- Run below command to install golang package.
curl -O https://dl.google.com/go/go1.18.3.linux-amd64.tar.gz
- Extract the package.
tar xvf go1.18.3.linux-amd64.tar.gz
- Set the GOPATH
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
- Run below command to check if docker and Docker Compose is successfully installed or not. This should return the version of it.
go version
Optional: Install the latest version of jq (only required for the tutorials related to channel configuration transactions).
sudo apt-get install jq
- Create new directory where you will install Hyperledger Fabric
mkdir fabric-network
- To get the install script:
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh
- 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 b
Congrats, you have installed Hyperledger Fabric with all dependencies.
- To test the our installation, we will run test network that comes with fabric-samples
cd fabric-samples/test-network
./network.sh down
./network.sh up
- Using following Docker command we can check all running containers
docker ps -a
You should be able to see the containers up and running.
- You can use the network.sh script to create a channel between Org1 and Org2 and join their peers to the channel. Run the following command to create a channel with the default name of mychannel:
./network.sh createChannel
- You can also use the channel flag to create a channel with custom name.Using following cmd:
./network.sh createChannel -c <channel_name>
- If you want to bring up the network and create a channel in a single step, you can use the up and createChannel modes together:
./network.sh up createChannel
Thank you!