1.下载go安装包,这里选择1.17.1版本amdx64架构的安装包
cd /usr/local && wget https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz -O go1.17.1.linux-amd64.tar.gz
2.解压go安装包
tar -xvzf go1.17.1.linux-amd64.tar.gz
文件!文件!文件!不是文件夹!
添加内容:
export GO111MODULE=on export GOPROXY=https://goproxy.cn export GOROOT=/usr/local/go export GOPATH=/usr/local/go/path export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
4.立即生效环境变量
source /etc/profile
5.检查go安装
go env
出来一大堆类似这样的就是安装完毕
GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/usr/local/go/path/pkg/mod" GonOPROXY="" GonOSUMDB="" GOOS="linux" GOPATH="/usr/local/go/path" GOPRIVATE="" GOPROXY="https://goproxy.cn" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.1" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_ConFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2786514601=/tmp/go-build -gno-record-gcc-switches"
收工
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)