ubuntu18安装go
1.下载go
go官网连不上,从golang中文社区下载go的安装包wget https://studygolang.com/dl/golang/go1.14.4.linux-amd64.tar.gz
2.将解压后的文件夹移动到 /usr/local/下
sudo mv go /usr/local/
3.配置工作目录GOPATH
创建自己的go工作目录:/home/ubuntu/go/
4.配置go开发环境变量
修改.hashrc
sudo gedit ~/.bashrc
后面添加:
export GOROOT=/usr/local/go
export GOPATH=/home/ubuntu/go/
export PATH=/home/ubuntu/go/bin:/usr/local/go/bin:$PATH
使修改生效
source ~/.bashrc
修改profile
sudo gedit /etc/profile
后面添加:
export GOROOT=/usr/local/go
export GOPATH=/home/ubuntu/go/
export PATH=/home/ubuntu/go/bin:/usr/local/go/bin:$PATH
使修改生效
source /etc/profile
查看
export
5.测试
go version
----------------陌上阡头,草长莺飞-----------------
https://www.cnblogs.com/tyche116/