cd /www/server && yum install -y wget && wget -O golang.tar.gz https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
tar -xzvf golang.tar.gz
wget -O profile.txt https://lowvps.cn/wp-content/uploads/2019/05/profile.txt
cat profile.txt >> /etc/profile
source /etc/profile
mkdir /www/wwwroot/Golang
echo -e "-----------------------------------------------------------------------------------"
echo -e "Golang环境安装成功!"
echo -e "Golang The environment is installed successfully!"
echo -e "-----------------------------------------------------------------------------------"
go version
profile.txt 内容
#############################################
# golang ENV
#############################################
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
source /etc/profile
有疑问加站长微信联系(非本文作者)