Installation of specified versions of Go, Node, Npm, and Npx for Hyperledger Fabric environment configuration

The specified version of Go is installed, taking go1.15 as an example

Go is installed by downloading a compressed package . The address for obtaining the installation packages of each version is: Go installation package library

Strart

1. Download the compressed package of the specified version

Download directly through the browser (not demonstrated here)

or

Download through the command line (if you need other versions, just change the corresponding version number)

$ wget https://dl.google.com/go/go1.15.linux-amd64.tar.gz

2. Unzip the compressed package to the /usr/local directory

$ sudo tar -zxvf go1.15.linux-amd64.tar.gz -C /usr/local

3. Create a working directory for go

$ cd 
$ mkdir gowork
$ cd gowork
$ mkdir bin src

After the command is executed, the following folders will appear

 4. Environment variable setting (in order to enable go to run in any directory)

$ vim /etc/profile 

After the above command is executed, the profile file will be opened, and the following content will be added at the end of the file

export GOROOT=/usr/local/go
export GOPATH=$HOME/gowork
export GOBIN=$GOPATH/bin
export PATH=$PATH:/usr/local/go/bin:$GOPATH:$GOBIN

After the addition is complete, press the Esc key, then press the Shift + : key, and then enter wq! (this series of operations is: save + exit)

5. Make the environment variable take effect

$ source /etc/profile

If you just enter the above command line, the environment variable will only be valid in the current terminal. So the one-and-done approach is:

(1) Open the user root directory.bashrc

$ cd
$ sudo vim ~/.bashrc

 (2) Add the following content at the end of the file

source /etc/profile

 (3) Save + exit (the specific operation is the same as above)

6. Check whether the installation is successful and display the version information

$ go version

output:

End

The installation of the specified version of Node, taking node v8.10.0 as an example

 The address of each version library of Node is: Node installation package

Start

1. Download the specified version of the Node installation package

(1) Download directly from the above-mentioned Node installation package link (no more demonstrations)

or

(2) Download via command line

$ wget https://nodejs.org/download/release/v8.1.0/node-v8.1.0-linux-x64.tar.gz

2. Unzip the compressed package and save it to the /usr/local directory

$ sudo tar -zxvf node-v8.10.0-linux-x64.tar.gz -C /usr/local

3. Configure environment variables

$ sudo ln -s /usr/local/node-v8.10.0-linux-x64/bin/node /usr/bin/node
$ sudo ln -s /usr/local/node-v8.10.0-linux-x64/bin/npm  /usr/bin/npm
$ sudo ln -s /usr/local/node-v8.10.0-linux-x64/bin/npx /usr/bin/npx

4. Check whether the installation is successful and output the version information

node:

$ node -v

output:

npm:

$ npm -v

output:

npx:

$ npx -v

 output:

 End

Guess you like

Origin blog.csdn.net/jianyuzhi/article/details/122210318