首先确认系统版本。
Linux:uname -r
Centos: cat /etc/redhat-release
更多:centos查看系统版本的方法有哪些(centos 如何查看系统版本) 路由器
备份本机原本的CentOS-Base.repo
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
根据版本下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Centos8
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
CentOs6
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
CentOs7
显示已保存后,执行
yum cleanup
yum makecache
等进度跑完
完成。