CentOS7安装go语言环境

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
    原文作者:锐心凌志
    原文地址: https://www.jianshu.com/p/c7d324f25f7b
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞