centos 8.2中安装go 1.7
作者:互联网
下载解压
golang 1.7下载地址:https://gomirrors.org/dl/go/go1.17.7.linux-amd64.tar.gz
#解压到/usr/local/下
tar -zxvf go1.17.7.linux-amd64.tar.gz /usr/local/
#修改~/.bash_profile ,导出环境变量
export GOROOT=/usr/local/go
export GOPROXY=https://goproxy.io,direct
export GOPATH=/root/gopath
PATH=$PATH:$HOME/bin:$GOROOT/bin
export PATH
#修改完毕后
source ~/.bash_profile
验证:
[root@master ~]# go version
go version go1.17.7 linux/amd64
[root@master ~]# 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="/root/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/gopath"
GOPRIVATE=""
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.7"
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-build1432673404=/tmp/go-build -gno-record-gcc-switches"
[root@master ~]#
标签:8.2,amd64,CGO,local,1.7,linux,go,root 来源: https://www.cnblogs.com/cosmos-wong/p/15894202.html