Centos install Golang 1.9 or later

Centos executes yum install golang, and the installed go version is 1.8

# go version
go version go1.8.3 linux/amd64

If you have installed go with yum, you can delete it with the following command

rm -rf /usr/bin/go
rm -rf /etc/alternatives/go
rm -rf /usr/lib/golang

If you want to install version 1.9 or later, you must first download the official tar package, as follows:

https://storage.googleapis.com/golang/go1.9.4.linux-amd64.tar.gz

If you can't access it, you can download it from CSDN https://download.csdn.net/download/zhang_gq/10311792

Transfer the tar package to Centos, and then operate the command reference:

# tar -C /root -xzf go1.9.4.linux-amd64.tar.gz
# cd /root; vi ~/.bashrc
export GOPATH=/root/Go
export GOROOT=/root/go
export PATH=$PATH:$GOROOT/bin
# source ~/.bashrc
# go version
go version go1.9.4 linux/amd64

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325742682&siteId=291194637