您现在的位置是: 首页 > 运维 CentOS 7 安装 Golang 环境
CentOS 7 安装 Golang 环境
2020-05-25 【运维】 3214人已围观 6025次浏览
简介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服务端
相关文章
- Debian apt 使用国内镜像
- mysql 索引过长1071-max key length is 767 byte
- ElasticSearch安装踩坑指南
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- linux下各文件夹的结构说明及用途介绍
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- 查看MySQL默认读取的配置文件
- Nginx转发阿里云OSS内网流量
点击排行
- 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 项目完整部署方案
站长推荐
猜你喜欢
- Vue 报错 Avoid using non-primitive value as key, use string/number value instead
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- Vue 监听回车 el-input 和 input 使用方法不同
- LNMP 手动更新 SSL 证书
- ThinkPHP 解决跨域访问问题
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- win10 cmd下运行python命令弹出windows应用商店问题
- start.spring.io访问太慢,构建SpringBoot项目失败
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- 在使用Flutter进行网络请求时,使用Dio访问https地址出现unable to get local issuer certificate错误