Fabric test network operation and installation detailed steps

It is recommended to perform it under the root command.
If under root, after entering go version,
Command 'go' not found, but can be installed with:

snap install go # version 1.18.2, or
apt install golang-go # version 2:1.13~1ubuntu2
apt install gccgo-go # version 2:1.13~1ubuntu2

Solution to why go cannot be used under root

Process steps:
#Start network

sudo ./network.sh up

Insert image description here

#create channel

sudo ./network.sh up createChannel

Insert image description here

#Switch to the go file to configure environment variables

cd ../chaincode/fabcar/go/
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
go mod vendor

#Switch to the network directory to configure the environment

cd ../../../test-network
export PATH=${
   
    
    PWD}/../bin:$PATH
export FABRIC_CFG_PATH=$PWD/../config/

#Add permissions

cd ..
sudo chmod +x test-network
cd test-network

#Check peer version

peer version

#Use the peer command to create a chaincode package on the peer node

peer lifecycle chaincode package fabcar.tar.gz  --path ../chaincode/fabcar/go/

Guess you like

Origin blog.csdn.net/weixin_42375493/article/details/125169867