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

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> ...
    Copy to Clipboard Toggle word wrap

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

  • 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>
      Copy to Clipboard Toggle word wrap
    • To remove a package group by the groupID, enter:

      # yum group remove <group_ID>
      Copy to Clipboard Toggle word wrap

8.3. Removing installed modular content

When removing installed modular content, you can remove packages from either a selected profile or from the whole stream.

Important

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

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/profile command or as a default profile by using the yum install module_name:stream command.

Procedure

  • Uninstall packages that belong to the selected profile:

    # yum module remove <module_name>:<stream>/<profile>
    Copy to Clipboard Toggle word wrap

    For example, to remove packages from the devel profile of the php:7.3 module 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]: y
    Copy to Clipboard Toggle word wrap
    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:

    # yum module remove <module_name>:<stream>
    Copy to Clipboard Toggle word wrap
    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:

    $ 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]ctive
    Copy to Clipboard Toggle word wrap

    All profiles except devel are currently installed ([i]).

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 are installed.

Procedure

  1. Remove all packages from a selected stream:

    # yum module remove --all <module_name>:<stream>
    Copy to Clipboard Toggle word wrap

    For example, to remove all packages from the php:7.3 module 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]: y
    Copy to Clipboard Toggle word wrap
    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.

  2. Optional: Reset or disable the stream by entering one of the following commands:

    # yum module reset <module_name>
    # yum module disable <module_name>
    Copy to Clipboard Toggle word wrap

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]ctive
    Copy to Clipboard Toggle word wrap

    The 7.3 stream of the php module is currently enabled ([e]) but no packages from this stream are installed ([i]).

8.4. Specifying package details for removal

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 -n to specify the exact name of the package.
  • Use -na to specify the exact package name and architecture.
  • Use -nevra to 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>
      Copy to Clipboard Toggle word wrap
    • To remove a package by using its exact name and architecture, enter:

      # yum remove-na <package_name>.<architecture>
      Copy to Clipboard Toggle word wrap
    • To remove a package by using its exact name, epoch, version, release, and architecture, enter:

      # yum remove-nevra <package_name>-<epoch>:<version>-<release>.<architecture>
      Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat