0. 概述
DNF 是 YUM 的下一代包管理软件,改进 YUM 包管理工具的一些问题,提升了用户体验,内存占用,依赖分析,运行速度等多方面的内容,本文就介绍一下如何在 CentOS 下体验 DNF。
1. YUM 快速安装
最常见的想法就是通过 YUM 安装,但是,如果你之前没有特别设置过 Repo 源的话,应该是安装不上的,例如:
[[email protected]]# yum install dnf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* elrepo: elrepo.mirror.angkasa.id
* epel: kartolo.sby.datautama.net.id
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Nothing to do
所以,你需要考虑添加一个额外的源,经过我的查找,在 EPEL 源中是有 DNF 的。
2. 添加 EPEL Repo
[[email protected]]# yum install epel-release
3. 安装 DNF
[[email protected]]# yum install dnf
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ocf.berkeley.edu
* extras: centos.mirror.ndchost.com
* nux-dextop: mirror.li.nux.ro
* updates: mirrors.ocf.berkeley.edu
... ...
Dependencies Resolved
=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
dnf noarch 4.0.9.2-1.el7_6 extras 357 k
Installing for dependencies:
dnf-data noarch 4.0.9.2-1.el7_6 extras 51 k
libcomps x86_64 0.1.8-13.el7 extras 75 k
libdnf x86_64 0.22.5-1.el7_6 extras 533 k
libmodulemd x86_64 1.6.3-1.el7 extras 141 k
librepo x86_64 1.8.1-7.el7 base 81 k
libsolv x86_64 0.6.34-4.el7 base 329 k
python2-dnf noarch 4.0.9.2-1.el7_6 extras 414 k
python2-hawkey x86_64 0.22.5-1.el7_6 extras 68 k
python2-libcomps x86_64 0.1.8-13.el7 extras 47 k
python2-libdnf x86_64 0.22.5-1.el7_6 extras 608 k
... ...
Dependency Installed:
dnf-data.noarch 0:4.0.9.2-1.el7_6 libcomps.x86_64 0:0.1.8-13.el7 libdnf.x86_64 0:0.22.5-1.el7_6
libmodulemd.x86_64 0:1.6.3-1.el7 librepo.x86_64 0:1.8.1-7.el7 libsolv.x86_64 0:0.6.34-4.el7
python2-dnf.noarch 0:4.0.9.2-1.el7_6 python2-hawkey.x86_64 0:0.22.5-1.el7_6 python2-libcomps.x86_64 0:0.1.8-13.el7
python2-libdnf.x86_64 0:0.22.5-1.el7_6
Complete!
4. 验证一下
[[email protected]]# dnf install flask-admin
Visual Studio Code 315 kB/s | 2.8 MB 00:09
... ...
Last metadata expiration check: 0:05:31 ago on Sat 01 Feb 2020 11:45:25 PM CST.
===================================================== Name Matched: flask-admin =====================================================
python-flask-admin.noarch : Simple and extensible admin interface framework for Flask
OK,看上去工作正常,完工。