Chapter 8. Removing RHEL 8 content
In the following sections, learn how to remove content in Red Hat Enterprise Linux 8 by using YUM.
8.1. Removing installed packages Copy linkLink copied to clipboard!
You can use YUM to remove a single package or multiple packages installed on your system. If any of the packages you choose to remove have unused dependencies, YUM uninstalls these dependencies as well.
Procedure
Remove particular packages:
# yum remove <package_name_1> <package_name_2> ...
8.2. Removing package groups Copy linkLink copied to clipboard!
Package groups bundle multiple packages. You can use package groups to remove all packages assigned to a group in a single step.
Procedure
Use one of the following methods to install a package group:
To remove a package group by a group name, enter one of the following commands::
# yum group remove <group_name> # yum remove @<group_name>To remove a package group by the groupID, enter:
# yum group remove <group_ID>
8.3. Removing installed modular content Copy linkLink copied to clipboard!
When removing installed modular content, you can remove packages from either a selected profile or from the whole stream.
YUM tries to remove all packages with a name corresponding to the packages installed with a profile or a stream, including their dependent packages. Always check the list of packages to be removed before you proceed, especially if you have enabled custom repositories on your system.
8.3.1. Removing packages from an installed profile Copy linkLink copied to clipboard!
When you remove packages installed with a profile, all packages with a name corresponding to the packages installed by the profile are removed. This includes their dependencies, with the exception of packages required by a different profile.
To remove all packages from a selected stream, complete the steps in Removing all packages from a module stream.
Prerequisites
-
The selected profile is installed by using the
yum module install module_name:stream/profilecommand or as a default profile by using theyum install module_name:streamcommand.
Procedure
Uninstall packages that belong to the selected profile:
# yum module remove <module_name>:<stream>/<profile>For example, to remove packages from the
develprofile of thephp:7.3module stream, enter:# yum module remove php:7.3/devel (...) Dependencies resolved. ========================================================================= Package Arch Version Repository Size ========================================================================= Removing: libzip x86_64 1.5.2-1.module+el8.1.0+3189+a1bff096 @rhel-8-for-x86_64-appstream-rpms 313 k php-devel x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 5.3 M php-pear noarch 1:1.10.9-1.module+el8.1.0+3189+a1bff096 @rhel-8-for-x86_64-appstream-rpms 2.1 M php-pecl-zip x86_64 1.15.4-1.module+el8.1.0+3189+a1bff096 @rhel-8-for-x86_64-appstream-rpms 119 k php-process x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 117 k Removing unused dependencies: autoconf noarch 2.69-27.el8 @rhel-8-for-x86_64-appstream-rpms 2.2 M ... Disabling module profiles: php/devel Transaction Summary ========================================================================= Remove 64 Packages Freed space: 193 M Is this ok [y/N]: yWarningCheck the list of packages under
Removing:andRemoving unused dependencies:before you proceed with the removal transaction. This transaction removes requested packages, unused dependencies, and dependent packages, which might result in the system failure.Alternatively, uninstall packages from all installed profiles within a stream:
# yum module remove <module_name>:<stream>NoteThese operations will not remove packages from the stream that do not belong to any of the profiles.
Verification
Verify that the correct profile was removed:
$ yum module info php ... Name : php Stream : 7.3 [e] [a] Version : 8020020200715124551 Context : ceb1cf90 Architecture : x86_64 Profiles : common [d] [i], devel, minimal [i] Default profiles : common Repo : rhel-AppStream ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctiveAll profiles except
develare currently installed ([i]).
8.3.2. Removing all packages from a module stream Copy linkLink copied to clipboard!
When you remove packages installed with a module stream, all packages with a name corresponding to the packages installed by the stream are removed. This includes their dependencies, with the exception of packages required by other modules.
To remove only packages from a selected profile, complete the steps in Removing packages from an installed profile.
Prerequisites
- The module stream is enabled and at least some packages from the stream are installed.
Procedure
Remove all packages from a selected stream:
# yum module remove --all <module_name>:<stream>For example, to remove all packages from the
php:7.3module stream, enter:# yum module remove --all php:7.3 (...) Dependencies resolved. ========================================================================= Package Arch Version Repository Size ========================================================================= Removing: libzip x86_64 1.5.2-1.module+el8.1.0+3189+a1bff096 @rhel-8-for-x86_64-appstream-rpms 313 k php-cli x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 11 M php-common x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 6.5 M php-devel x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 5.3 M php-fpm x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 5.6 M php-json x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 53 k php-mbstring x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 1.9 M php-pear noarch 1:1.10.9-1.module+el8.1.0+3189+a1bff096 @rhel-8-for-x86_64-appstream-rpms 2.1 M php-pecl-zip x86_64 1.15.4-1.module+el8.1.0+3189+a1bff096 @rhel-8-for-x86_64-appstream-rpms 119 k php-process x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 117 k php-xml x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 @rhel-8-for-x86_64-appstream-rpms 557 k Removing unused dependencies: autoconf noarch 2.69-27.el8 @rhel-8-for-x86_64-appstream-rpms 2.2 M ... Disabling module profiles: php/common php/devel php/minimal Transaction Summary ========================================================================= Remove 73 Packages Freed space: 220 M Is this ok [y/N]: yWarningCheck the list of packages under
Removing:andRemoving unused dependencies:before you proceed with the removal transaction. This transaction removes requested packages, unused dependencies, and dependent packages, which might result in the system failure.Optional: Reset or disable the stream by entering one of the following commands:
# yum module reset <module_name> # yum module disable <module_name>
Verification
Verify that all packages from the selected module stream were removed:
$ yum module info php ... Name : php Stream : 7.3 [e] [a] Version : 8020020200715124551 Context : ceb1cf90 Architecture : x86_64 Profiles : common [d], devel, minimal Default profiles : common ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctiveThe
7.3stream of thephpmodule is currently enabled ([e]) but no packages from this stream are installed ([i]).
8.4. Specifying package details for removal Copy linkLink copied to clipboard!
You can specify package details for a precise package removal process. To do so, append the following suffixes to the yum remove command to explicitly define how to parse an argument:
-
Use
-nto specify the exact name of the package. -
Use
-nato specify the exact package name and architecture. -
Use
-nevrato specify the exact package name, epoch, version, release, and architecture.
Procedure
Depending on your scenario, use one of the following options to optimize the package removal process:
To remove a package by using its exact name, enter:
# yum remove-n <package_name>To remove a package by using its exact name and architecture, enter:
# yum remove-na <package_name>.<architecture>To remove a package by using its exact name, epoch, version, release, and architecture, enter:
# yum remove-nevra <package_name>-<epoch>:<version>-<release>.<architecture>