The work needs to build a go environment, and the specific steps are summarized as memos. Please use the pagoda to build the LAMP or LNMP environment. The steps to build the go environment are as follows:
1. Open the official website https://golang.google.cn/dl/ to obtain the download address: https://dl.google.com/go/go1.15.7.linux-amd64.tar.gz
2. Download and unzip:
cd /www/server && wget -O https://dl.google.com/go/go1.15.7.linux-amd64.tar.gz
tar -xzvf go1.15.7.linux-amd64.tar.gz
3. Add environment variables, use to open the /etc/profile file, and add at the bottom:
vi /etc/profile
export GOROOT=/www/server/go
export GOBIN=$GOROOT/bin
export GOPKG=$GOROOT/pkg/tool/linux_amd64
export GOARCH=amd64
export GOOS=linux
export GOPATH=/www/wwwroot/Golang
export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin
4. Execute the following command to make it effective:
source /etc/profile
5. Perform inspection:
go version
6. If it returns go version go1.15.7 linux/amd64, it means success, continue to create the GOROOT directory:
mkdir /www/wwwroot/Golang
At this point, all the work is completed and can be used normally