Chapter 8. Removing RHEL 9 content In the following sections, learn how to remove content in Red Hat Enterprise Linux 9 by using DNF . 8.1. Removing installed packages You can use DNF to remove a single package or multiple packages installed on your system. If any of the packages you choose to remove have unused dependencies, DNF uninstalls these dependencies as well. Procedure Remove particular packages: 8.2. Removing package groups Package groups bundle multiple packages. You can use package groups to remove all packages assigned to a group in a single step. Procedure Remove package groups by the group name or group ID: 8.3. Removing installed modular content When removing installed modular content, you can remove packages from either a selected profile or the whole stream . Important DNF 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 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 dnf module install <module-name:stream/profile> command or as a default profile by using the dnf install <module-name:stream command> . Procedure Uninstall packages that belong to the selected profile: For example, to remove packages and their dependencies from the development profile of the nodejs:18 module stream, enter: Warning Check the list of packages under Removing: and Removing 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: Note These 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: All profiles except development are currently installed ( [i] ). Additional resources Modular dependencies and stream changes 8.3.2. Removing all packages from a module stream 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 have been installed. Procedure Remove all packages from a selected stream: For example, to remove all packages from the nodejs:18 module stream, enter: Warning Check the list of packages under Removing: and Removing 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: Verification Verify that all packages from the selected module stream were removed: Additional resources Modular dependencies and stream changes Resetting module streams Disabling all streams of a module 8.4. Additional resources Commands for removing content in RHEL 9

Commands:
dnf remove <package_name_1> <package_name_2>
dnf group remove <group_name> <group_id>
dnf module remove <module-name:stream/profile>
dnf module remove nodejs:18/development (...) Dependencies resolved. ======================================================================== Package Architecture Version Repository Size ======================================================================== Removing: nodejs-devel x86_64 1:18.7.0-1.module+el9.1.0+16284+4fdefb2f @rhel-AppStream 950 k Removing unused dependencies: brotli x86_64 1.0.9-6.el9 @rhel-AppStream 754 k brotli-devel x86_64 1.0.9-6.el9 @rhel-AppStream 55 k Disabling module profiles: nodejs/development Transaction Summary ======================================================================== Remove 26 Packages Freed space: 8.3 M Is this ok [y/N]: y
dnf module remove module-name:stream
dnf module info nodejs Name : nodejs Stream : 18 [e] [a] Version : 9010020221009220316 Context : rhel9 Architecture : x86_64 Profiles : common [d] [i], development, minimal [i], s2i [i] Default profiles : common Repo : rhel-AppStream Summary : Javascript runtime Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive
dnf module remove --all <module_name:stream>
dnf module remove --all nodejs:18 (...) Dependencies resolved. =================================================================================== Package Architecture Version Repository Size =================================================================================== Removing: nodejs x86_64 1:18.10.0-3.module+el9.1.0+16866+0fab0697 @rhel-AppStream 43 M nodejs-devel x86_64 1:18.10.0-3.module+el9.1.0+16866+0fab0697 @rhel-AppStream 953 k nodejs-docs noarch 1:18.10.0-3.module+el9.1.0+16866+0fab0697 @rhel-AppStream 78 M nodejs-full-i18n x86_64 1:18.10.0-3.module+el9.1.0+16866+0fab0697 @rhel-AppStream 29 M nodejs-nodemon noarch 2.0.15-1.module+el9.1.0+15718+e52ec601 @rhel-AppStream 2.0 M nodejs-packaging noarch 2021.06-4.module+el9.1.0+15718+e52ec601 @rhel-AppStream 41 k npm x86_64 1:8.19.2-1.18.10.0.3.module+el9.1.0+16866+0fab0697 @rhel-AppStream 6.9 M Removing unused dependencies: brotli x86_64 1.0.9-6.el9 @rhel-AppStream 754 k brotli-devel x86_64 1.0.9-6.el9 @rhel-AppStream 55 k Disabling module profiles: nodejs/common nodejs/development nodejs/minimal nodejs/s2i Transaction Summary =================================================================================== Remove 31 Packages Freed space: 167 M Is this ok [y/N]: y
dnf module reset <module_name> dnf module disable <module_name>
dnf module info nodejs Name : nodejs Stream : 18 [e] [a] Version : 9010020221009220316 Context : rhel9 Architecture : x86_64 Profiles : common [d], development, minimal, s2i Default profiles : common Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive