CentOS7.x更换yum源

QioCuIi 943 0

CentOS7.X怎样更新yum源

备份默认的yum源

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

设置阿里云的yum源

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

或者

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

添加EPEL源

wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo

清理缓存

yum clean all

生成新缓存

yum makecache

执行yum系统更新

yum -y update //升级所有包同时也升级软件和系统内核;
yum -y upgrade //只升级所有包,不升级软件和系统内核

说明:生产环境不要随意的进行yum update操作!!!!!!!!!

发表评论 取消回复
表情 图片 链接 代码

分享