Centos執行yum install golang,安裝的go版本爲1.8linux
# go version go version go1.8.3 linux/amd64
若是已經yum安裝了go,能夠經過下面的命令刪掉golang
rm -rf /usr/bin/go rm -rf /etc/alternatives/go rm -rf /usr/lib/golang
若是想要安裝1.9以上版本,得先下載官方提供的tar包,以下:api
https://storage.googleapis.com/golang/go1.9.4.linux-amd64.tar.gzbash
若是訪問不了,能夠從CSDN上下載https://download.csdn.net/download/zhang_gq/10311792google
將tar包傳到Centos上,以後操做命令參考:.net
# 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