概述
yum卸载的时候,使用remove卸载应用的时候,会卸载很多依赖
例如
yum remove dhcpd
会卸载117个包,很多依赖都被卸载
如果只卸载单独的dhcp软件包
可以使用rpm -e --nodeps 软件名
# rpm -qa | grep dhcp
dhcp-4.4.2-7.uel20.x86_64
# rpm -e --nodeps dhcp-4.4.2-7.uel20.x86_64
那么卸载多余的依赖,想要恢复怎么办呢?
这里yum有一个特殊的命令yum history
[root@node1 ~]# yum history --help
usage: yum history [-c [config file]] [-q] [-v] [–version]
[–installroot [path]] [–nodocs] [–noplugins]
[–enableplugin [plugin]] [–disableplugin [plugin]]
[–releasever RELEASEVER] [–setopt SETOPTS]
[–skip-broken] [-h] [–allowerasing] [-b | --nobest] [-C]
[-R [minutes]] [-d [debug level]] [–debugsolver]
[–showduplicates] [-e ERRORLEVEL] [–obsoletes]
[–rpmverbosity [debug level name]] [-y] [–assumeno]
[–enablerepo [repo]] [–disablerepo [repo] | --repo
[repo]] [–enable | --disable] [-x [package]]
[–disableexcludes [repo]] [–repofrompath [repo,path]]
[–noautoremove] [–nogpgcheck] [–color COLOR] [–refresh]
[-4] [-6] [–destdir DESTDIR] [–downloadonly]
[–comment COMMENT] [–bugfix] [–enhancement]
[–newpackage] [–security] [–advisory ADVISORY]
[–bz BUGZILLA] [–cve CVES]
[–sec-severity {Critical,Important,Moderate,Low}]
[–forcearch ARCH]
[COMMAND] [TRANSACTION [TRANSACTION …]]display, or use, the transaction history
General YUM options:
-c [config file], --config [config file]
config file location
-q, --quiet quiet operation
-v, --verbose verbose operation
–version show YUM 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 RELEASEVER
override the value of $releasever in config and repo
files
–setopt SETOPTS set arbitrary config and repo options
–skip-broken resolve depsolve problems by skipping packages
-h, --help, --help-cmd
show command help
–allowerasing allow erasing of installed packages to resolve
dependencies
-b, --best try the best available package versions in
transactions.
–nobest do not limit the transaction to the best candidate
-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 ERRORLEVEL
error output level
–obsoletes enables yum’s obsoletes processing logic for upgrade
or display capabilities that the package obsoletes for
info, 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] Enable additional repositories. List option. Supports
globs, can be specified multiple times.
–disablerepo [repo] Disable repositories. List option. Supports globs, can
be specified multiple times.
–repo [repo], --repoid [repo]
enable just specific repositories by an id or a glob,
can be specified multiple times
–enable enable repos with config-manager command
(automatically saves)
–disable disable 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 an additional repository to use
(same path as in a baseurl), can be specified multiple
times.
–noautoremove disable removal of dependencies that are no longer
used
–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 DESTDIR
set 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 ADVISORY
Include packages needed to fix the given advisory, in
updates
–bz BUGZILLA, --bzs BUGZILLA
Include packages needed to fix the given BZ, in
updates
–cve CVES, --cves CVES
Include packages needed to fix the given CVE, in
updates
–sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Important,Moderate,Low}
Include security relevant packages matching the
severity, in updates
–forcearch ARCH Force the use of an architectureCOMMAND Available commands: list (default), info, redo, undo,
rollback, userinstalled
TRANSACTION Transaction ID (, ‘last’ or ‘last-’
for one transaction, … for range)
常用的选项有 yum history list
yum history info Noxxx
yum history undo Noxxx
测试环境中查看:
具体用法如下:
# yum history list
ID | Command line | Date and time | Action(s) | Altered
----------------------------------------------------------------------------------------------------------------------------------------------
15 | remove dhcp | 2022-09-28 09:58 | Removed | 117 EE
14 | reinstall dhcp -y | 2022-09-28 09:57 | R | 2
13 | install nginx -y | 2022-09-21 16:55 | Install | 9
12 | install qemu qemu-img libvirt libguestfs-tools virt-manager virt-install virt-viewer | 2022-09-21 16:11 | I, U | 162 EE
11 | install appstream.x86_64 | 2022-09-21 14:00 | Install | 2
10 | install mariadb-server | 2022-09-21 11:33 | Install | 5
9 | install mariadb | 2022-09-21 11:29 | Install | 2
8 | install targetcli | 2022-09-21 09:47 | Install | 7
7 | install samba | 2022-09-20 15:58 | I, U | 8
6 | install httpd | 2022-09-15 11:53 | Install | 7
5 | install dhcp -y | 2022-09-15 10:26 | Upgrade | 1
4 | install rpcbind nfs-utils | 2022-09-14 13:52 | Upgrade | 2 EE
3 | install vim -y | 2022-09-14 09:53 | Install | 4
2 | install bind -y | 2022-09-14 09:38 | Upgrade | 5
1 |
# yum history info 15
Transaction ID : 15
Begin time : 2022年09月28日 星期三 09时58分16秒
Begin rpmdb : 1533:845d806d11c868672e00dee48164ac2746007264
End time : 2022年09月28日 星期三 10时00分08秒 (112 seconds)
End rpmdb : 1416:ae72b9cc10b1a56a20d712a92406841b52888876
User : root <root>
Return-Code : Success
Releasever : 1050
Command Line : remove dhcp
Comment :
Packages Altered:
Removed afflib-3.7.16-10.uel20.x86_64 @@System
Removed anaconda-33.19-31.up14.uel20.x86_64 @@System
Removed anaconda-core-33.19-31.up14.uel20.x86_64 @@System
Removed anaconda-tui-33.19-31.up14.uel20.x86_64 @@System
Removed anaconda-user-help-26.1-9.uel20.noarch @@System
Removed babeltrace-1.5.8-1.uel20.x86_64 @@System
Removed blivet-data-1:3.2.2-8.uel20.noarch @@System
Removed bubblewrap-0.3.3-1.uel20.x86_64 @@System
Removed clevis-11-6.uel20.x86_64 @@System
Removed cockpit-178-9.up1.uel20.x86_64 @@System
Removed createrepo_c-0.16.0-3.uel20.x86_64 @@System
Removed debootstrap-1.0.109-3.uel20.noarch @@System
Removed dhcp-12:4.4.2-7.uel20.x86_64 @@System
Removed dhcp-help-12:4.4.2-6.uel20.noarch @@System
Removed dpkg-1.18.25-11.uel20.x86_64 @@System
Removed dracut-live-050-5.uel20.x86_64 @@System
Removed dracut-network-050-5.uel20.x86_64 @@System
Removed dracut-squash-050-5.uel20.x86_64 @@System
Removed drpm-0.5.0-1.uel20.x86_64 @@System
Removed fcoe-utils-1.0.32-7.uel20.x86_64 @@System
Removed flatpak-1.0.3-7.uel20.x86_64 @@System
Removed fltk-1.3.5-1.uel20.x86_64 @@System
Removed fros-1.1-18.uel20.noarch @@System
Removed gdb-9.2-3.up1.uel20.x86_64 @@System
Removed gdb-headless-9.2-3.up1.uel20.x86_64 @@System
Removed gdb-help-9.2-3.up1.uel20.noarch @@System
Removed gfs2-utils-3.2.0-5.uel20.x86_64 @@System
Removed hexedit-1.2.13-15.uel20.x86_64 @@System
Removed hfsplus-tools-540.1.linux3-17.uel20.x86_64 @@System
Removed hivex-1.3.17-4.uel20.x86_64 @@System
Removed initial-setup-0.3.83-2.up2.uel20.x86_64 @@System
Removed isomd5sum-1:1.2.3-4.uel20.x86_64 @@System
Removed jfsutils-1.1.15-14.uel20.x86_64 @@System
Removed jose-10-5.uel20.x86_64 @@System
Removed kexec-tools-2.0.20-16.up5.uel20.x86_64 @@System
Removed keybinder3-0.3.2-9.uel20.x86_64 @@System
Removed langtable-0.0.51-1.uel20.noarch @@System
Removed libewf-20140608-14.uel20.x86_64 @@System
Removed libgnomekbd-3.26.1-1.uel20.x86_64 @@System
Removed libguestfs-1:1.40.2-13.up1.uel20.x86_64 @@System
Removed libipt-2.0.3-1.uel20.x86_64 @@System
Removed libldm-0.2.4-3.uel20.x86_64 @@System
Removed libnma-1.8.22-2.uel20.x86_64 @@System
Removed libreport-2.10.1-10.uel20.x86_64 @@System
Removed libreport-anaconda-2.10.1-10.uel20.x86_64 @@System
Removed libreport-cli-2.10.1-10.uel20.x86_64 @@System
Removed libreport-gtk-2.10.1-10.uel20.x86_64 @@System
Removed libreport-plugin-reportuploader-2.10.1-10.uel20.x86_64 @@System
Removed libreport-web-2.10.1-10.uel20.x86_64 @@System
Removed libtar-1.2.20-18.uel20.x86_64 @@System
Removed lldpad-1.0.1-15.uel20.x86_64 @@System
Removed luksmeta-9-4.uel20.x86_64 @@System
Removed mac-robber-1.02-18.uel20.x86_64 @@System
Removed nbdkit-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-basic-filters-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-basic-plugins-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-help-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-python-plugin-common-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-python3-plugin-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-server-1.6.2-7.up1.uel20.x86_64 @@System
Removed nbdkit-vddk-plugin-1.6.2-7.up1.uel20.x86_64 @@System
Removed nilfs-utils-2.2.7-6.uel20.x86_64 @@System
Removed nm-connection-editor-1.8.22-2.uel20.x86_64 @@System
Removed ntfs-3g-2:2022.5.17-1.uel20.x86_64 @@System
Removed ostree-2020.4-2.uel20.x86_64 @@System
Removed perl-Class-Inspector-1.36-1.uel20.noarch @@System
Removed perl-File-ShareDir-1.116-4.uel20.noarch @@System
Removed perl-Sys-Guestfs-1:1.40.2-13.up1.uel20.x86_64 @@System
Removed perl-Sys-Virt-6.1.0-1.uel20.x86_64 @@System
Removed perl-hivex-1.3.17-4.uel20.x86_64 @@System
Removed perl-libintl-perl-1.31-1.uel20.x86_64 @@System
Removed pipewire-0.2.7-1.uel20.x86_64 @@System
Removed python3-blivet-1:3.2.2-8.uel20.noarch @@System
Removed python3-blockdev-2.24-8.up1.uel20.x86_64 @@System
Removed python3-bytesize-2.4-1.uel20.x86_64 @@System
Removed python3-dasbus-1.3-1.uel20.noarch @@System
Removed python3-kickstart-3.27-1.uel20.x86_64 @@System
Removed python3-langtable-0.0.51-1.uel20.noarch @@System
Removed python3-libreport-2.10.1-10.uel20.x86_64 @@System
Removed python3-meh-0.48-1.uel20.noarch @@System
Removed python3-ntplib-0.3.4-1.uel20.noarch @@System
Removed python3-ordered-set-3.1.1-1.uel20.noarch @@System
Removed python3-pid-3.0.4-2.uel20.noarch @@System
Removed python3-productmd-1.26-2.up1.uel20.noarch @@System
Removed python3-pwquality-1.4.2-1.uel20.x86_64 @@System
Removed python3-pyparted-1:3.11.4-1.uel20.x86_64 @@System
Removed python3-pytz-2020.1-1.uel20.noarch @@System
Removed python3-requests-file-1.5.1-1.uel20.noarch @@System
Removed python3-requests-ftp-0.3.1-15.uel20.noarch @@System
Removed python3-simpleline-1.7-1.uel20.noarch @@System
Removed python3-systemd-234-12.uel20.x86_64 @@System
Removed reiserfs-utils-3.6.27-2.uel20.x86_64 @@System
Removed satyr-0.27-5.uel20.x86_64 @@System
Removed scrub-2.5.2-14.uel20.x86_64 @@System
Removed setroubleshoot-plugins-3.3.9-8.uel20.noarch @@System
Removed setroubleshoot-server-3.3.20-4.uel20.x86_64 @@System
Removed sleuthkit-4.6.7-10.uel20.x86_64 @@System
Removed squashfs-tools-4.4-5.uel20.x86_64 @@System
Removed supermin-5.1.19-12.up1.uel20.x86_64 @@System
Removed syslinux-extlinux-6.04-11.uel20.x86_64 @@System
Removed syslinux-extlinux-nonlinux-6.04-11.uel20.noarch @@System
Removed tigervnc-1.10.1-5.uel20.x86_64 @@System
Removed tigervnc-server-minimal-1.10.1-5.uel20.x86_64 @@System
Removed tmux-2.9a-2.uel20.x86_64 @@System
Removed tpm2-tools-5.0-3.uel20.x86_64 @@System
Removed tpm2-tools-help-5.0-3.uel20.noarch @@System
Removed tpm2-tss-3.0.3-1.uel20.x86_64 @@System
Removed udisks2-lvm2-2.9.0-2.up2.uel20.x86_64 @@System
Removed usermode-1.113-3.up1.uel20.x86_64 @@System
Removed virt-install-2.1.0-3.uel20.noarch @@System
Removed xdg-desktop-portal-1.0.2-2.uel20.x86_64 @@System
Removed xdg-desktop-portal-gtk-1.0.2-2.uel20.x86_64 @@System
Removed xmlrpc-c-1.51.06-1.uel20.x86_64 @@System
Removed yelp-2:3.36.0-1.uel20.x86_64 @@System
Removed yelp-xsl-3.36.0-1.uel20.noarch @@System
Removed zenity-3.32.0-1.uel20.x86_64 @@System
Removed zerofree-1.1.1-3.uel20.x86_64 @@System
Scriptlet output:
1 Removed /etc/systemd/system/multi-user.target.wants/kdump.service.
2 警告:/var/lib/dhcpd/dhcpd.leases 已另存为 /var/lib/dhcpd/dhcpd.leases.rpmsave
3 警告:/etc/dhcp/dhcpd.conf 已另存为 /etc/dhcp/dhcpd.conf.rpmsave
如果依赖包比较少的话,可以手动安装的,但100多依赖包,单独安装,很头疼
下一个命令yum history undo Noxxx
## 从yum history list 中看到remove dhcp的编号是15
# yum history undo 15
会自动安装全部误操作卸载的依赖
等待全部写在完成后,再手动执行rpm -e --nodeps 软件名
最后
以上就是健忘期待为你收集整理的【Linux】yum卸载恢复的全部内容,希望文章能够帮你解决【Linux】yum卸载恢复所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复