您现在的位置是: 首页 > 运维 CentOS 7 安装 Golang 环境
CentOS 7 安装 Golang 环境
2020-05-25 【运维】 2842人已围观 5275次浏览
简介CentOS 7 安装 Golang 环境
CentOS 提示 go: 未找到命令
原因其实就是没有 golang 环境,下面是两种安装方式
第一种:
yum 直接安装,简单方便,但不是最新版
yum install golang
第二种:
二进制文件安装
官网:https://golang.org/dl/
镜像官网:https://golang.google.cn/dl/
下载稳定版本安装
wget https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz
将二进制文件解压到 /usr/local 目录
tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz
最后将 /usr/local/go/bin 目录添加至PATH环境变量(需要注意的是,该命令仅对当前会话有效,关闭或退出后失效)
export PATH=$PATH:/usr/local/go/bin
设置永久环境变量(如果需要立即验证 golang 是否安装成功,执行上面的命令已经足够,长期使用需要设置永久环境变量)
# 首先编辑 /etc/profile 文件(针对所有用户生效)
vim /etc/profile
# 在头部位置新增一行
export PATH=$PATH:/usr/local/go/bin
# wq 保存退出后,执行命令使其生效
source /etc/profile
查看 golang 版本
go version
上面命令输出下面的内容,则 golang 环境安装完成
go version go1.14.3 linux/amd64
很赞哦! (0)
上一篇:获取阿里云CDN真实IP
下一篇:自建Ngrok服务端
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- nuxt 项目完整部署方案
- idea去掉Smart commands execution提示
- mysql 索引过长1071-max key length is 767 byte
- Vue 路由跳转后不在顶部
- 防止Time Machine备份Parallels Desktop的虚拟硬盘文件
- ElasticSearch安装踩坑指南
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- gulp3 在 node12 上运行出现异常 primordials is not defined
- SpringBoot @NotBlank 不生效问题