-
下载golang源码安装包
wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
-
解压文件
tar -zxvf go1.12.1.linux-amd64.tar.gz -C /usr/local/bin/
-
配置环境变量
echo "export GOROOT=/usr/local/bin/go/" >> ~/.bashrc echo "export PATH=$GOROOT/bin:$PATH" >> ~/.bashrc echo "export GOPATH=$HOME/work/go" >> ~/.bashrc echo "export PATH=$PATH:$GOPATH/bin" >> ~/.bashrc source ~/.bashrc
-
测试安装是否成功
[root@iZ2ze40depfadmv9xdxdsxZ src]# go version go version go1.12.1 linux/amd64
有疑问加站长微信联系(非本文作者)