当前位置: > CentOS > CentOS教程 >

CentOS7安装go语言环境

时间:2019-12-06 11:35来源:linux.it.net.cn 作者:IT
1、安装go语言环境

[root@172 ~]# yum install golang -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Resolving Dependencies
.......

Installed:
  golang.x86_64 0:1.8.3-1.el7                                                                                                  

Dependency Installed:
  golang-bin.x86_64 0:1.8.3-1.el7                                golang-src.noarch 0:1.8.3-1.el7                              

Complete!



2、检查安装情况

[root@172 ~]# go version
go version go1.8.3 linux/amd64



3、设置环境变量
在/etc/profile中添加GOROOT和GOPATH,如下:

export GOROOT=/usr/lib/golang
export GOPATH=/home

# 生效配置
source /etc/profile

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容