dnf是新一代的RPM软件包管理器,与yum包管理器相比,在用户体验、内存占用、依赖分析、运行速度等多方面得到了较好的提升。
dnf首次出现在Fedora18(注:中文名费多拉,Fedora对于用户而言,是一套功能完备、更新快速的免费操作系统)这个发行版中,在Fedora22发行版本中正式取代yum成为其默认的包管理器。
dnf未默认在RHEL或CentOS 7系统中安装,如果使用,可以单独安装。
# 安装epel-release依赖
yum install epel-release
# 安装dnf包
yum install dnf
dnf options COMMAND
查看dnf包管理器的版本
[root@iZ~]# dnf --version
4.2.23
已安装: dnf-0:4.2.23-4.el8.noarch 在 2021年01月08日 星期五 07时08分18秒
构建 :CentOS Buildsys <bugs@centos.org> 在 2020年08月04日 星期二 18时52分03秒 已安装: rpm-0:4.14.3-4.el8.x86\_64 在 2021年01月08日 星期五 07时07分57秒
构建 :CentOS Buildsys [bugs@centos.org](mailto:bugs@centos.org) 在 2020年07月21日 星期二 17时36分08秒
查看可用的dnf软件库
[root@iZ ~]# dnf repolist
查看可用和不可用的dnf软件库
[root@iZ ~]# dnf repolist all
dnf search 软件包名称
[root@iZ ~]# dnf search wget
列出已安装和可安装软件包列表
@
开头的为已安装状态
[root@iZ ~]# dnf list
列出已安装软件包列表
[root@iZ ~]# dnf list installed
列出可安装软件包列表
[root@iZ ~]# dnf list available
查看软件包详情
[root@iZ ~]# dnf info wget
Repository epel is listed more than once in the configuration
上次元数据过期检查:0:44:48 前,执行于 2021年11月22日 星期一 22时50分11秒。
已安装的软件包
名称 : wget
版本 : 1.19.5
发布 : 10.el8
架构 : x86_64
大小 : 2.8 M
源 : wget-1.19.5-10.el8.src.rpm
仓库 : @System
来自仓库 : AppStream
概况 : A utility for retrieving files using the HTTP or FTP protocols
URL : http://www.gnu.org/software/wget/
协议 : GPLv3+
描述 : GNU Wget is a file retrieval utility which can use either the HTTP or
: FTP protocols. Wget features include the ability to work in the
: background while you are logged out, recursive retrieval of
: directories, file name wildcard matching, remote file timestamp
: storage and comparison, use of Rest with FTP servers and Range with
: HTTP servers to retrieve files over slow or unstable connections,
: support for Proxy servers, and configurability.
查看可更新软件包列表
[root@iZ ~]# dnf check-update
查看dnf执行历史
[root@iZ ~]# dnf history
-y 安装时全部选是 -q 不显示安装过程
# dnf install -y 软件包名称
[root@iZ ~]# dnf install -y wget
重新安装特定软件包
[root@iZ ~]# dnf reinstall wget
升级所有软件包
[root@iZ ~]# dnf update
或
[root@iZ ~]# dnf upgrade
升级指定软件包
[root@iZ ~]# dnf update -y wget
升级所有软件包至最新稳定发行版
[root@iZ ~]# dnf distro-sync
回滚软件包版本root@iZ ~# dnf downgrade wget
卸载指定软件包
[root@iZ ~]# dnf remove -y wget
卸载无用孤立的软件包
[root@iZ ~]# dnf autoremove
清理缓存的无用软件包
[root@iZ ~]# dnf clean all
参与到21天挑战计划中来,相信在坚持了21天后能成为一个不一样的自己。Come on!让我们一起行动起来!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。