CentOS 更新yum源

常用操作:
1、备份,为了更新失败时切换回去
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、进入yum源配置文件夹
cd /etc/yum.repos.d/

3、根据centos版本下载对应的新源
centos5:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
centos6:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
centos7:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4、yum makecache 生成缓存,会把新下载CentOS-Base.repo源生效。
更新时会报某个aliyun timeout,他会自动尝试阿里其他镜像,最后自己会用基础镜像,然后自动更新一部分。因为基础镜像过时了。

5、试试更新系统 yum -y update

6、yum -y install 安装的软件

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?