安装wget
yun install -y wget
下载
wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
解压压缩包到/usr/local目录
tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz
将/usr/local/go/bin 目录添加至PATH环境变量
export PATH=$PATH:/usr/local/go/bin
重新读取环境变量
source /etc/profile
查看版本
go version
设置GOPATH
- 全局设置
vi /etc/profile
在文件的结尾加上
export GOPATH=/usr/local/src/go_path
使配置马上生效
source /etc/profile
- 用户级别设置
vi ~/.bash_profile
在文件的结尾加上
export GOPATH=/usr/local/src/go_path
使配置马上生效
source /etc/profile
- 临时生效
直接在命令行添加
export GOPATH=/usr/local/src/go_path
安装beego报错
unable to access ‘https://github.com/astaxie/beego/’: Failed connect to github.com:443; Connection refused
可以尝试解决:
- 添加dns解析
https://blog.csdn.net/YJ108283/article/details/95044692 - 修改hosts,解析github.com域名
https://www.cnblogs.com/AGoodDay/p/11161887.html
151.101.44.249 github.global.ssl.fastly.net
192.30.253.113 github.com
103.245.222.133 assets-cdn.github.com
23.235.47.133 assets-cdn.github.com
203.208.39.104 assets-cdn.github.com
204.232.175.78 documentcloud.github.com
204.232.175.94 gist.github.com
107.21.116.220 help.github.com
207.97.227.252 nodeload.github.com
199.27.76.130 raw.github.com
107.22.3.110 status.github.com
204.232.175.78 training.github.com
207.97.227.243 www.github.com
185.31.16.184 github.global.ssl.fastly.net
185.31.18.133 avatars0.githubusercontent.com
185.31.19.133 avatars1.githubusercontent.com