1. Check the Linux version: uname -a

2. Find the corresponding Go language installation package according to the system version.studygolang.com/dl

3. Go to the /usr/local directory, download the Go language installation package, and decompress the package.

CD/usr/local / # wget download the installation package for https://studygolang.com/dl/golang/go1.14.1.linux-amd64.tar.gz # extract tar ZXVF - installation kit Go1.14.1. Linux - amd64. Tar. GzCopy the code

4. Create a working directory

Bin (the directory where the compiled executable files are stored), PKG (the directory where the generated. A files are stored when the package is compiled), and SRC (the directory where the source files are created).

mkdir -p /home/go/bin/home/go/pkg /home/go/src
Copy the code

5. Configure environment variables:

Export GOROOT=/usr/local/go export GOPATH=/home/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin # Save and exit :wq #Copy the code

6. Run the go version command to view the go version, and the installation is successful.

Run the go env command to check the configuration:

At this point, the Go language environment has been successfully built.