先更新系统
sed -i 's/jessie/stretch/g' /etc/apt/sources.list; apt upgrade -y; apt update -y;
安装golang
apt-get install golang git -y
升级go
cd /root mkdir -p work git clone https://github.com/golang/go.git cd go/src ./all.bash mv /root/go /usr/local echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >>~/.bashrc echo 'export GOPATH=$HOME/work' >>~/.bashrc source ~/.profile mv /usr/bin/go /usr/bin/goold ln -s /usr/local/go/bin/go /usr/bin/go
查看go版本
go version