1. 备份
mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.bak
2. 下载新的CentOS-Base.repo 到 /etc/yum.repos.d/ (这里用的CentOS 8.0)
旧的 yum 源也许已经更新了,下载之前先确认是否存在,或者 从多个路径 渠道 下载
wget -O /etc/yum.repos.d/redhat.repo http://mirrors.aliyun.com/repo/Centos-8.repo
#或者
curl -o /etc/yum.repos.d/redhat.repo http://mirrors.aliyun.com/repo/Centos-8.repo
centos 8 快速配置阿里yum源
wget -O /etc/yum.repos.d/aliyuan.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3. 清除缓存,生成缓存
# 清除缓存
yum clean all
# 生存缓存
yum makecache
dnf clean all
dnf makecache
4. 关于Redhat 8中错误删除了yum的解决
虽然 Redhat 8 中没有apt,但是有 dnf ,也就是yum的升级版,用它下载一个yum就OK了
dnf install yum
5. CentOS7 安装和使用DNF
– 安装 DNF 包管理器
DNF 并未默认安装在 RHEL 或 CentOS 7系统中,但是 Fedora 22 已经默认使用 DNF .
1.为了安装 DNF ,您必须先安装并启用 epel-release 依赖。
在系统中执行以下命令:
yum install epel-release
或者
yum install epel-release -y
其实这里并没有强制使用”-y”的理由,相反的,在不使用”-y”的情况下,用户可以在安装过程中查看到底有哪些东西被安装进了系统。但对于没有这个需求的用户,您可以在 YUM 中使用”-y”参数来自动安装所有东西。
2.使用 epel-release 依赖中的 YUM 命令来安装 DNF 包。、
在系统中执行以下命令:
yum install dnf
然后, DNF 包管理器就被成功的安装到你的系统中了。
转载于:https://blog.csdn.net/m0_37264220/article/details/103787945
参照1:https://blog.csdn.net/choupieying8011/article/details/101008458
参照2:https://blog.csdn.net/renren_100/article/details/114279439
参照3:https://blog.csdn.net/C_Intelligent_J/article/details/119740128
参照4:https://my.oschina.net/liuyuantao/blog/756133