Linux系统换源

1. 首先备份源文件

[root@ifcos ~]#cd /etc/yum.repos.d/
[root@ifcos yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.bak

2. 下载163源

[root@ifcos yum.repos.d]#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@ifcos yum.repos.d]#ls
CentOS7-Base-163.repo  CentOS-Base.repo.bak

3. 查看系统发行版本和系统架构

查看系统发行版本

[root@ifcos yum.repos.d]#cat /etc/ifcos-release 
IFCOS release 6.4 (Final)

查看系统架构

[root@ifcos yum.repos.d]#uname -a
Linux ifcos.ifcosdomain 2.6.32-358.23.2.el6.centos.plus.x86_64 #1 SMP Thu Oct 17 00:31:29 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

修改163源文件中的地址为适合自己系统的地址

在修改之前,可以先访问163源地址http://mirrors.163.com/centos

由于我的系统发行版本为6.4,而6.4 文件夹下面没有东西,点开readme,发现这一版本已经被弃用,可以使用版本6代替6.4,readme文件如下:

This directory (and version of CentOS) is deprecated.  For normal users,
you should use /6/ and not /6.4/ in your path. Please see this FAQ
concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 6.4
level, go to http://vault.centos.org/ for packages. 

Please keep in mind that 6.0, 6.1, 6.2, 6.3 and 6.4 no longer gets any updates, nor
any security fix's.

修改163源

baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/6/os/x86_64/

将源文件中的版本修改为系统对应版本,同时修改系统架构。

4. 运行命令生成缓存

[root@ifcos yum.repos.d]#yum clean all
[root@ifcos yum.repos.d]#yum makecache

参考博客:https://blog.youkuaiyun.com/wang_shen_tao/article/details/78676560

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值