centos7更改国内源
1、个人安装环境
1.1 CentOS Linux release 7.7.1908 (Core)
2、更改目的
有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想。这时候需要将yum源设置为国内镜像站点。
国内主要开源的开源镜像站点应该是网易和阿里云了。具体使用哪个可以根据PING命令获取time,选择time较小源
1 2 3 4 5 | [root@localhost yum.repos.d] # ping 163.com PING 63.com (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time =0.099 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time =0.097 ms 64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time =0.101 ms |
1 2 3 4 5 | [root@localhost yum.repos.d] # ping aliyun.com PING aliyun.com (106.11.172.51) 56(84) bytes of data. 64 bytes from 106.11.172.51 (106.11.172.51): icmp_seq=1 ttl=128 time =17.7 ms 64 bytes from 106.11.172.51 (106.11.172.51): icmp_seq=2 ttl=128 time =17.4 ms 64 bytes from 106.11.172.51 (106.11.172.51): icmp_seq=3 ttl=128 time =15.6 ms |
3、安装步骤
3.1 备份源文件
1 | mv /etc/yum .repos.d /CentOS-Base .repo /etc/yum .repos.d /CentOS-Base .repo.backup |
3.2 下载更改源
- CentOS5
1 | wget -O /etc/yum .repos.d /CentOS-Base .repo http: //mirrors .aliyun.com /repo/Centos-5 .repo |
- CentOS6
1 | wget -O /etc/yum .repos.d /CentOS-Base .repo http: //mirrors .aliyun.com /repo/Centos-6 .repo |
- CentOS7
1 | wget -O /etc/yum .repos.d /CentOS-Base .repo http: //mirrors .aliyun.com /repo/Centos-7 .repo |
根据centos版本下载对应的新源,这里以CentOS7为例
1 | wget -O /etc/yum .repos.d /CentOS-Base .repo http: //mirrors .aliyun.com /repo/Centos-7 .repo |
如果wget命令不生效,说明还没有安装wget工具,输入yum -y install wget 回车进行安装,或者使用
1 | curl -O http: //mirrors .aliyun.com /repo/Centos-7 .repo |
3.3 清空yum缓存并生存cache文件
1 2 | yum clean all yum makecache |
3.4 尝试更新系统
1 | yum -y update |
分类:
Linux
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架