Tips:一些记录,一些笔记

2024/08/28
THURSDAY
Labor is harmless and sorrow injury body.
劳动无害,忧愁伤身。

01
DNF(Dandified Yum)
DNF原先是Fedora Linux中的一个包管理器,它是基于YUM开发的,其主要特点是:快速、可靠、易用,以及优秀的用户体验。
DNF提供了许多强大的功能和命令行工具:
| 安装和升级软件包 | dnf install dnf update |
| 查询和列出软件包 | dnf search dnf list |
| 删除软件包 | dnf remove |
| 清理系统 | dnf clean |
| 版本历史 | dnf history |
| 软件包组管理 | dnf group |
| 存储库管理 | dnf repolist dnf config |
02
DNF的安装
查看软件仓库:
[root@ansible ~]# cat etc/system-releaseCentOS Linux release 7.9.2009 (Core)[root@ansible ~]#[root@ansible ~]# yum list | grep epel-releaseepel-release.noarch 7-14 epel[root@ansible ~]#[root@ansible ~]# yum repolistLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.comrepo id repo name statusbase/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,791extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 526updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 6,173repolist: 30,562[root@ansible ~]#
执行安装:
[root@ansible ~]# yum list | grep "^dnf"dnf.noarch 4.0.9.2-2.el7_9 extrasdnf-automatic.noarch 4.0.9.2-2.el7_9 extrasdnf-data.noarch 4.0.9.2-2.el7_9 extrasdnf-langpacks.noarch 0.15.1-1.el7 epeldnf-langpacks-conf.noarch 0.15.1-1.el7 epeldnf-plugins-core.noarch 4.0.2.2-3.el7_6 extras[root@ansible ~]#[root@ansible ~]# yum install -y dnf(... 过多的输出)Installing : libcomps-0.1.8-14.el7.x86_64 7/11Installing : python2-libcomps-0.1.8-14.el7.x86_64 8/11Installing : dnf-data-4.0.9.2-2.el7_9.noarch 9/11Installing : python2-dnf-4.0.9.2-2.el7_9.noarch 10/11Installing : dnf-4.0.9.2-2.el7_9.noarch 11/11Verifying : python2-libcomps-0.1.8-14.el7.x86_64 1/11Verifying : dnf-4.0.9.2-2.el7_9.noarch 2/11Verifying : librepo-1.8.1-8.el7_9.x86_64 3/11Verifying : python2-hawkey-0.22.5-2.el7_9.x86_64 4/11Verifying : libmodulemd-1.6.3-1.el7.x86_64 5/11Verifying : dnf-data-4.0.9.2-2.el7_9.noarch 6/11Verifying : libdnf-0.22.5-2.el7_9.x86_64 7/11Verifying : python2-dnf-4.0.9.2-2.el7_9.noarch 8/11Verifying : libcomps-0.1.8-14.el7.x86_64 9/11Verifying : libsolv-0.6.34-4.el7.x86_64 10/11Verifying : python2-libdnf-0.22.5-2.el7_9.x86_64 11/11Installed:dnf.noarch 0:4.0.9.2-2.el7_9Dependency Installed:dnf-data.noarch 0:4.0.9.2-2.el7_9 libcomps.x86_64 0:0.1.8-14.el7libdnf.x86_64 0:0.22.5-2.el7_9 libmodulemd.x86_64 0:1.6.3-1.el7librepo.x86_64 0:1.8.1-8.el7_9 libsolv.x86_64 0:0.6.34-4.el7python2-dnf.noarch 0:4.0.9.2-2.el7_9 python2-hawkey.x86_64 0:0.22.5-2.el7_9python2-libcomps.x86_64 0:0.1.8-14.el7 python2-libdnf.x86_64 0:0.22.5-2.el7_9Complete![root@ansible ~]#
通过「rpm」命令,看看它到底装了些什么:
[root@ansible ~]# rpm -qa | grep '^dnf'dnf-4.0.9.2-2.el7_9.noarchdnf-data-4.0.9.2-2.el7_9.noarch[root@ansible ~]#[root@ansible ~]# rpm -ql dnf/etc/bash_completion.d/dnf/usr/bin/dnf/usr/lib/systemd/system/dnf-makecache.service/usr/lib/systemd/system/dnf-makecache.timer/usr/share/locale/ar/LC_MESSAGES/dnf.mo/usr/share/locale/bg/LC_MESSAGES/dnf.mo/usr/share/locale/bn_IN/LC_MESSAGES/dnf.mo/usr/share/locale/ca/LC_MESSAGES/dnf.mo/usr/share/locale/cs/LC_MESSAGES/dnf.mo/usr/share/locale/da/LC_MESSAGES/dnf.mo/usr/share/locale/de/LC_MESSAGES/dnf.mo/usr/share/locale/el/LC_MESSAGES/dnf.mo/usr/share/locale/en_GB/LC_MESSAGES/dnf.mo/usr/share/locale/es/LC_MESSAGES/dnf.mo/usr/share/locale/eu/LC_MESSAGES/dnf.mo/usr/share/locale/fi/LC_MESSAGES/dnf.mo/usr/share/locale/fil/LC_MESSAGES/dnf.mo/usr/share/locale/fr/LC_MESSAGES/dnf.mo/usr/share/locale/fur/LC_MESSAGES/dnf.mo/usr/share/locale/gd/LC_MESSAGES/dnf.mo/usr/share/locale/gu/LC_MESSAGES/dnf.mo/usr/share/locale/he/LC_MESSAGES/dnf.mo/usr/share/locale/hi/LC_MESSAGES/dnf.mo/usr/share/locale/hr/LC_MESSAGES/dnf.mo/usr/share/locale/hu/LC_MESSAGES/dnf.mo/usr/share/locale/id/LC_MESSAGES/dnf.mo/usr/share/locale/it/LC_MESSAGES/dnf.mo/usr/share/locale/ja/LC_MESSAGES/dnf.mo/usr/share/locale/ka/LC_MESSAGES/dnf.mo/usr/share/locale/kk/LC_MESSAGES/dnf.mo/usr/share/locale/ko/LC_MESSAGES/dnf.mo/usr/share/locale/lt/LC_MESSAGES/dnf.mo/usr/share/locale/ml/LC_MESSAGES/dnf.mo/usr/share/locale/mr/LC_MESSAGES/dnf.mo/usr/share/locale/ms/LC_MESSAGES/dnf.mo/usr/share/locale/nb/LC_MESSAGES/dnf.mo/usr/share/locale/nl/LC_MESSAGES/dnf.mo/usr/share/locale/pa/LC_MESSAGES/dnf.mo/usr/share/locale/pl/LC_MESSAGES/dnf.mo/usr/share/locale/pt/LC_MESSAGES/dnf.mo/usr/share/locale/pt_BR/LC_MESSAGES/dnf.mo/usr/share/locale/ru/LC_MESSAGES/dnf.mo/usr/share/locale/sk/LC_MESSAGES/dnf.mo/usr/share/locale/sq/LC_MESSAGES/dnf.mo/usr/share/locale/sr/LC_MESSAGES/dnf.mo/usr/share/locale/sr@latin/LC_MESSAGES/dnf.mo/usr/share/locale/sv/LC_MESSAGES/dnf.mo/usr/share/locale/th/LC_MESSAGES/dnf.mo/usr/share/locale/tr/LC_MESSAGES/dnf.mo/usr/share/locale/uk/LC_MESSAGES/dnf.mo/usr/share/locale/ur/LC_MESSAGES/dnf.mo/usr/share/locale/zh_CN/LC_MESSAGES/dnf.mo/usr/share/locale/zh_TW/LC_MESSAGES/dnf.mo/usr/share/man/man8/dnf.8.gz/usr/share/man/man8/yum2dnf.8.gz/var/cache/dnf[root@ansible ~]#
03
DNF的使用
查看版本信息:
[root@ansible ~]# dnf --version4.0.9Installed: dnf-0:4.0.9.2-2.el7_9.noarch at Thu 29 Aug 2024 08:09:47 AM CSTBuilt : CentOS BuildSystem <http://bugs.centos.org> at Wed 07 Apr 2021 03:52:38 PM CSTInstalled: rpm-0:4.11.3-45.el7.x86_64 at Thu 29 Aug 2024 06:54:47 AM CSTBuilt : CentOS BuildSystem <http://bugs.centos.org> at Wed 30 Sep 2020 05:30:03 PM CST[root@ansible ~]#
查看帮助信息:
[root@ansible ~]# dnf --helpusage: dnf [options] COMMANDList of Main Commands:alias List or create command aliasesautoremove remove all unneeded packages that were originally installed as dependenciescheck check for problems in the packagedbcheck-update check for available package upgradesclean remove cached datadeplist List package's dependencies and what packages provide themdistro-sync synchronize installed packages to the latest available versionsdowngrade Downgrade a packagegroup display, or use, the groups informationhelp display a helpful usage messagehistory display, or use, the transaction historyinfo display details about a package or group of packagesinstall install a package or packages on your systemlist list a package or groups of packagesmakecache generate the metadata cachemark mark or unmark installed packages as installed by user.module Interact with Modules.provides find what package provides the given valuereinstall reinstall a packageremove remove a package or packages from your systemrepolist display the configured software repositoriesrepoquery search for packages matching keywordrepository-packages run commands on top of all packages in given repositorysearch search package details for the given stringshell run an interactive DNF shellswap run an interactive dnf mod for remove and install one specupdateinfo display advisories about packagesupgrade upgrade a package or packages on your systemupgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your systemOptional arguments:-c [config file], --config [config file]config file location-q, --quiet quiet operation-v, --verbose verbose operation--version show DNF version and exit--installroot [path] set install root--nodocs do not install documentations--noplugins disable all plugins--enableplugin [plugin]enable plugins by name--disableplugin [plugin]disable plugins by name--releasever RELEASEVERoverride the value of $releasever in config and repofiles--setopt SETOPTS set arbitrary config and repo options--skip-broken resolve depsolve problems by skipping packages-h, --help, --help-cmdshow command help--allowerasing allow erasing of installed packages to resolvedependencies-b, --best try the best available package versions intransactions.-C, --cacheonly run entirely from system cache, don't update cache-R [minutes], --randomwait [minutes]maximum command wait time-d [debug level], --debuglevel [debug level]debugging output level--debugsolver dumps detailed solving results into files--showduplicates show duplicates, in repos, in list/search commands-e ERRORLEVEL, --errorlevel ERRORLEVELerror output level--obsoletes enables dnf's obsoletes processing logic for upgradeor display capabilities that the package obsoletes forinfo, list and repoquery--rpmverbosity [debug level name]debugging output level for rpm-y, --assumeyes automatically answer yes for all questions--assumeno automatically answer no for all questions--enablerepo [repo]--disablerepo [repo]--repo [repo], --repoid [repo]enable just specific repositories by an id or a glob,can be specified multiple times--enable, --set-enabledenable repos with config-manager command(automatically saves)--disable, --set-disableddisable repos with config-manager command(automatically saves)-x [package], --exclude [package], --excludepkgs [package]exclude packages by name or glob--disableexcludes [repo], --disableexcludepkgs [repo]disable excludepkgs--repofrompath [repo,path]label and path to additional repository, can bespecified multiple times.--noautoremove disable removal of dependencies that are no longerused--nogpgcheck disable gpg signature checking (if RPM policy allows)--color COLOR control whether color is used--refresh set metadata as expired before running the command-4 resolve to IPv4 addresses only-6 resolve to IPv6 addresses only--destdir DESTDIR, --downloaddir DESTDIRset directory to copy packages to--downloadonly only download packages--comment COMMENT add a comment to transaction--bugfix Include bugfix relevant packages, in updates--enhancement Include enhancement relevant packages, in updates--newpackage Include newpackage relevant packages, in updates--security Include security relevant packages, in updates--advisory ADVISORY, --advisories ADVISORYInclude packages needed to fix the given advisory, inupdates--bzs BUGZILLA Include packages needed to fix the given BZ, inupdates--cves CVES Include packages needed to fix the given CVE, inupdates--sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Important,Moderate,Low}Include security relevant packages matching theseverity, in updates--forcearch ARCH Force the use of an architecture[root@ansible ~]#
常用命令:
| install | 安装一个或多个软件包 |
| remove | 卸载一个或多个软件包 |
| update | 更新现有的软件包 |
| upgrade | 更新系统中所有的软件包(包括依赖项) |
| info | 查询软件包详细信息 |
| search | 搜索软件包 |
| list | 列出系统中所有已安装的软件包 |
| clean | 清除系统中的缓存 |
| check-update | 检查系统中可用的更新 |
| repository | 管理YUM仓库 |
| module | 管理模块 |
| group | 管理软件包组 |
| config-manager | 管理 DNF 配置文件和库 |
| version | 查看 DNF 版本信息 |
04
查询软件库
查询可用软件库:dnf repolist
查询所有软件库:dnf repolist all
具体如下:
[root@ansible ~]# dnf repolistExtra Packages for Enterprise Linux 7 - x86_64 240 kB/s | 17 MB 01:13CentOS-7 - Base - mirrors.aliyun.com 214 kB/s | 10 MB 00:48CentOS-7 - Updates - mirrors.aliyun.com 287 kB/s | 34 MB 02:03CentOS-7 - Extras - mirrors.aliyun.com 54 kB/s | 361 kB 00:06Last metadata expiration check: 0:00:01 ago on Thu 29 Aug 2024 04:20:59 PM CST.repo id repo name statusbase CentOS-7 - Base - mirrors.aliyun.com 10,072epel Extra Packages for Enterprise Linux 7 - x86_64 13,791extras CentOS-7 - Extras - mirrors.aliyun.com 526updates CentOS-7 - Updates - mirrors.aliyun.com 6,173[root@ansible ~]#[root@ansible ~]# dnf repolist allLast metadata expiration check: 0:00:13 ago on Thu 29 Aug 2024 04:20:59 PM CST.repo id repo name statusbase CentOS-7 - Base - mirrors.aliyun.com enabled: 10,072centosplus CentOS-7 - Plus - mirrors.aliyun.com disabledcontrib CentOS-7 - Contrib - mirrors.aliyun.com disabledepel Extra Packages for Enterprise Linux 7 - x86_64 enabled: 13,791epel-debuginfo Extra Packages for Enterprise Linux 7 - x86_64 - Debug disabledepel-source Extra Packages for Enterprise Linux 7 - x86_64 - Source disabledextras CentOS-7 - Extras - mirrors.aliyun.com enabled: 526updates CentOS-7 - Updates - mirrors.aliyun.com enabled: 6,173[root@ansible ~]#
05
查询系统的RPM包
查询系统中所有的软件包:
[root@ansible ~]# dnf list | head -n 30Last metadata expiration check: 0:00:46 ago on Thu 29 Aug 2024 04:20:59 PM CST.Installed PackagesGConf2.x86_64 3.2.6-8.el7 @SystemGeoIP.x86_64 1.5.0-14.el7 @SystemModemManager.x86_64 1.6.10-4.el7 @SystemModemManager-glib.x86_64 1.6.10-4.el7 @SystemNetworkManager.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-adsl.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-bluetooth.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-glib.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-libnm.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-libreswan.x86_64 1.2.4-2.el7 @SystemNetworkManager-libreswan-gnome.x86_64 1.2.4-2.el7 @SystemNetworkManager-ppp.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-team.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-tui.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-wifi.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-wwan.x86_64 1:1.18.8-1.el7 @SystemPackageKit.x86_64 1.1.10-2.el7.centos @SystemPackageKit-command-not-found.x86_64 1.1.10-2.el7.centos @SystemPackageKit-glib.x86_64 1.1.10-2.el7.centos @SystemPackageKit-gstreamer-plugin.x86_64 1.1.10-2.el7.centos @SystemPackageKit-gtk3-module.x86_64 1.1.10-2.el7.centos @SystemPackageKit-yum.x86_64 1.1.10-2.el7.centos @SystemPyYAML.x86_64 3.10-11.el7 @Systemabattis-cantarell-fonts.noarch 0.0.25-1.el7 @Systemabrt.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-ccpp.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-kerneloops.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-pstoreoops.x86_64 2.1.11-60.el7.centos @System[root@ansible ~]#
查询已安装的RPM包:
[root@ansible ~]# dnf list installed | head -n 30Installed PackagesGConf2.x86_64 3.2.6-8.el7 @SystemGeoIP.x86_64 1.5.0-14.el7 @SystemModemManager.x86_64 1.6.10-4.el7 @SystemModemManager-glib.x86_64 1.6.10-4.el7 @SystemNetworkManager.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-adsl.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-bluetooth.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-glib.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-libnm.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-libreswan.x86_64 1.2.4-2.el7 @SystemNetworkManager-libreswan-gnome.x86_64 1.2.4-2.el7 @SystemNetworkManager-ppp.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-team.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-tui.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-wifi.x86_64 1:1.18.8-1.el7 @SystemNetworkManager-wwan.x86_64 1:1.18.8-1.el7 @SystemPackageKit.x86_64 1.1.10-2.el7.centos @SystemPackageKit-command-not-found.x86_64 1.1.10-2.el7.centos @SystemPackageKit-glib.x86_64 1.1.10-2.el7.centos @SystemPackageKit-gstreamer-plugin.x86_64 1.1.10-2.el7.centos @SystemPackageKit-gtk3-module.x86_64 1.1.10-2.el7.centos @SystemPackageKit-yum.x86_64 1.1.10-2.el7.centos @SystemPyYAML.x86_64 3.10-11.el7 @Systemabattis-cantarell-fonts.noarch 0.0.25-1.el7 @Systemabrt.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-ccpp.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-kerneloops.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-pstoreoops.x86_64 2.1.11-60.el7.centos @Systemabrt-addon-python.x86_64 2.1.11-60.el7.centos @System[root@ansible ~]#
查询可供安装的RPM包:
[root@ansible ~]# dnf list available | head -n 30Last metadata expiration check: 0:02:49 ago on Thu 29 Aug 2024 04:20:59 PM CST.Available Packages0ad.x86_64 0.0.22-1.el7 epel0ad-data.noarch 0.0.22-1.el7 epel0install.x86_64 2.11-1.el7 epel2048-cli.x86_64 0.9.1-1.el7 epel2048-cli-nocurses.x86_64 0.9.1-1.el7 epel2ping.noarch 3.2.1-2.el7 epel389-ds-base.src 1.3.11.1-5.el7_9 updates389-ds-base.x86_64 1.3.11.1-5.el7_9 updates389-ds-base-devel.x86_64 1.3.11.1-5.el7_9 updates389-ds-base-libs.x86_64 1.3.11.1-5.el7_9 updates389-ds-base-snmp.x86_64 1.3.11.1-5.el7_9 updates3proxy.x86_64 0.9.4-2.el7 epel4diac-forte.x86_64 1.9.0-0.1.M3.el7 epel90-Second-Portraits.noarch 1.01b-3.el7 epelAMF-devel.noarch 1.4.30-1.el7 epelAMF-samples.noarch 1.4.30-1.el7 epelAgda.x86_64 2.3.2.2-5.el7 epelAntTweakBar.x86_64 1.16-2.el7 epelAntTweakBar-devel.x86_64 1.16-2.el7 epelAusweisApp2.x86_64 1.14.3-2.el7 epelAusweisApp2-data.noarch 1.14.3-2.el7 epelAusweisApp2-doc.noarch 1.14.3-2.el7 epelBEDTools.x86_64 2.26.0-1.el7 epelBackupPC.x86_64 3.3.1-5.el7 epelBackupPC-XS.x86_64 0.59-1.el7 epelBareBonesBrowserLaunch.noarch 3.1-7.el7 epelBareBonesBrowserLaunch-javadoc.noarch 3.1-7.el7 epelBibTool.x86_64 2.63-1.el7 epel[root@ansible ~]#
查询某个软件包:
[root@ansible ~]# dnf search ansibleLast metadata expiration check: 0:03:33 ago on Thu 29 Aug 2024 04:20:59 PM CST.===================================== Name Exactly Matched: ansible ======================================ansible.noarch : SSH-based configuration management, deployment, and task execution system==================================== Name & Summary Matched: ansible =====================================ansible-doc.noarch : Documentation for Ansibleansible-lint.noarch : Best practices checker for Ansiblepython2-ansible-tower-cli.noarch : A CLI tool for Ansible Toweransible-test.noarch : Tool for testing ansible plugin and module codeansible-inventory-grapher.noarch : Creates graphs representing ansible inventoryvim-ansible.noarch : Vim plugin for syntax highlighting ansible's common filetypespython2-ansible-runner.noarch : A tool and python library to interface with Ansibleansible-openstack-modules.noarch : Unofficial Ansible modules for managing Openstackansible-review.noarch : Reviews Ansible playbooks, roles and inventory and suggests improvementsansible-collection-microsoft-sql.noarch : The Ansible collection for Microsoft SQL Server managementcentos-release-ansible26.noarch : Ansible 2.6 packages from the CentOS ConfigManagement SIG repositorycentos-release-ansible-27.noarch : Ansible 2.7 packages from the CentOS ConfigManagement SIG repositorycentos-release-ansible-28.noarch : Ansible 2.8 packages from the CentOS ConfigManagement SIG repositorycentos-release-ansible-29.noarch : Ansible 2.9 packages from the CentOS ConfigManagement SIG repository========================================= Name Matched: ansible ==========================================ansible-python3.noarch : SSH-based configuration management, deployment, and task execution systemkubernetes-ansible.noarch : Playbook and set of roles for seting up a Kubernetes cluster onto machines======================================== Summary Matched: ansible ========================================scap-security-guide-rule-playbooks.noarch : Ansible playbooks per each rule.standard-test-roles.noarch : Standard Test Interface Ansible rolesloopabull.noarch : Event loop driven Ansible playbook execution enginepaternoster.noarch : Allows to run ansible playbooks like ordinary python or bash scripts[root@ansible ~]#
查询某个命令所对应的软件包:
[root@ansible ~]# dnf provides bin/bashLast metadata expiration check: 0:04:27 ago on Thu 29 Aug 2024 04:20:59 PM CST.bash-4.2.46-34.el7.x86_64 : The GNU Bourne Again shellRepo : @SystemMatched from:Provide : bin/bashbash-4.2.46-34.el7.x86_64 : The GNU Bourne Again shellRepo : baseMatched from:Provide : bin/bashbash-4.2.46-35.el7_9.x86_64 : The GNU Bourne Again shellRepo : updatesMatched from:Provide : bin/bash[root@ansible ~]#
06
安装与卸载
安装:
[root@ansible ~]# dnf install -y treeLast metadata expiration check: 0:05:00 ago on Thu 29 Aug 2024 04:20:59 PM CST.Dependencies resolved.==========================================================================================================Package Arch Version Repository Size==========================================================================================================Installing:tree x86_64 1.6.0-10.el7 base 46 kTransaction Summary==========================================================================================================Install 1 PackageTotal download size: 46 kInstalled size: 87 kDownloading Packages:tree-1.6.0-10.el7.x86_64.rpm 8.4 kB/s | 46 kB 00:05----------------------------------------------------------------------------------------------------------Total 8.4 kB/s | 46 kB 00:05Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transactionPreparing : 1/1Installing : tree-1.6.0-10.el7.x86_64 1/1Verifying : tree-1.6.0-10.el7.x86_64 1/1Installed:tree-1.6.0-10.el7.x86_64Complete![root@ansible ~]#
卸载:
[root@ansible ~]# dnf remove -y treeDependencies resolved.==========================================================================================================Package Arch Version Repository Size==========================================================================================================Removing:tree x86_64 1.6.0-10.el7 @base 87 kTransaction Summary==========================================================================================================Remove 1 PackageFreed space: 87 kRunning transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transactionPreparing : 1/1Erasing : tree-1.6.0-10.el7.x86_64 1/1Verifying : tree-1.6.0-10.el7.x86_64 1/1Removed:tree-1.6.0-10.el7.x86_64Complete![root@ansible ~]#
更新软件包:
[root@ansible ~]# dnf update -y treeLast metadata expiration check: 0:07:22 ago on Thu 29 Aug 2024 04:20:59 PM CST.Dependencies resolved.Nothing to do.Complete![root@ansible ~]#
检查系统软件包的更新:
[root@ansible ~]# dnf check-update | head -n 10Last metadata expiration check: 0:08:20 ago on Thu 29 Aug 2024 04:20:59 PM CST.NetworkManager.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-adsl.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-bluetooth.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-glib.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-libnm.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-ppp.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-team.x86_64 1:1.18.8-2.el7_9 updatesNetworkManager-tui.x86_64 1:1.18.8-2.el7_9 updates[root@ansible ~]#
升级所有系统软件包:
dnf updatednf upgrade
07
DNF的命令执行历史
具体如下:
[root@ansible ~]# dnf historyID | Command line | Date and time | Action(s) | Altered-------------------------------------------------------------------------------4 | install ansible-python3 | 2024-08-29 16:29 | Install | 193 | install -y tree | 2024-08-29 16:27 | Install | 12 | remove -y tree | 2024-08-29 16:26 | Removed | 11 | install -y tree | 2024-08-29 16:26 | Install | 1[root@ansible ~]#
08
软件包组
查看所有的软件包组:
[root@ansible ~]# dnf grouplistLast metadata expiration check: 0:11:11 ago on Thu 29 Aug 2024 04:20:59 PM CST.Available Environment Groups:Minimal InstallCompute NodeInfrastructure ServerFile and Print ServerCinnamon DesktopMATE DesktopBasic Web ServerVirtualization HostServer with GUIGNOME DesktopKDE Plasma WorkspacesDevelopment and Creative WorkstationAvailable Groups:CinnamonEducational SoftwareElectronic LabFedora PackagerGeneral Purpose DesktopHaskellLXQt DesktopMATEMilkymistTurboGears application frameworkXfceCompatibility LibrariesConsole Internet ToolsDevelopment ToolsGraphical Administration ToolsLegacy UNIX CompatibilityScientific SupportSecurity ToolsSmart Card SupportSystem Administration ToolsSystem Management[root@ansible ~]#
安装其中某一个软件包组:
dnf groupinstall "System Management
09
软件包
查询软件包的详细信息:
[root@ansible ~]# dnf info ansible-python3Last metadata expiration check: 0:13:10 ago on Thu 29 Aug 2024 04:20:59 PM CST.Installed PackagesName : ansible-python3Version : 2.9.27Release : 1.el7Arch : noarchSize : 141 MSource : ansible-2.9.27-1.el7.src.rpmRepo : @SystemFrom repo : epelSummary : SSH-based configuration management, deployment, and task execution systemURL : http://ansible.comLicense : GPLv3+Description ::::: Ansible is a radically simple model-driven configuration management,: multi-node deployment, and remote task execution system. Ansible works: over SSH and does not require any software or daemons to be installed: on remote nodes. Extension modules can be written in any language and: are transferred to managed machines automatically.:: This package installs versions of ansible that execute on Python3.[root@ansible ~]#
END
温馨提示
如果你喜欢本文,请分享到朋友圈,想要获得更多信息,请关注我。
文章转载自Nephilim,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




