Loading

CentOS7 安装 golang

1. yum 安装

$ yum -y install epel-release
$ yum -y install golang
$ go version
go version go1.15.5 linux/amd64

2. 二进制包安装

下载:https://golang.org/dl/

$ wget https://dl.google.com/go/go1.12.10.linux-amd64.tar.gz
$ tar -zxvf go1.12.10.linux-amd64.tar.gz -C /usr/local/
$ mkdir /usr/local/go/projects
$ vi /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/usr/local/go/projects  # 工作环境
export PATH=$GOROOT/bin:$PATH
$ . /etc/profile
$ go env

go 命令无响应问题

go env -w GOPROXY=https://goproxy.cn
# 永久有效
echo "export GOPROXY=https://goproxy.io,direct" >> ~/.profile && source ~/.profile
posted @ 2021-05-18 17:48  LB477  阅读(118)  评论(0编辑  收藏  举报