首页 > 服务器    日期:2020-10-22 / 来自互联网 / 浏览

经常使用Centos的小伙伴经常会遇到系统更新和需要更改yum源的情况,接下来为大家介绍一下Centos更改yum源与更新系统的方法,有需要的小伙伴可以参考一下:

1、更改yum源:

    (1)、备份系统:

/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

    (2)、进入yum源所在文件夹

cd /etc/yum.repos.d/

    (3)、下载aliyun的yum源,放在指定的文件夹

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

对应Centos6的用户,我们可以下载下面的yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

2、生成缓存:

yum makecache

3、系统更新:

yum -y update

PS:更新完记得reboot重启一下服务器

注意:在更改的时候如果提示:yum提示Another app is currently holding the yum lock; waiting for it to exit,我们可以通过一下命令强制关掉对应的yum进程

rm -f /var/run/yum.pid

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章