Chapter 5. Removing RHEL 8 content

The following sections describe how to remove content in Red Hat Enterprise Linux 8:

5.1. Removing installed packages

This section describes how to remove packages.

Procedure

  • Remove the package:

    # yum remove package

    The package is removed together with any other dependent packages.

5.2. Removing installed modular content

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

Important

YUM will try 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.

5.2.1. 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, including their dependencies, with the exception of packages required by other modules.

Prerequisites

  • The module stream has been enabled and at least some packages from the stream have been installed.
  • You must understand modular dependency resolution.

Procedure

  1. Remove all packages from a selected stream:

    # yum module remove --all module-name:stream

    Replace module-name and stream with the module and stream you wish to uninstall.

  2. Check the list of packages under Removing: and Removing unused dependencies: before you proceed with the removal transaction.
  3. Optionally, reset or disable the stream.

If you want to remove only packages from a selected profile, follow instructions in Section 5.2.2, “Removing packages from an installed profile”.

Example 5.1. Removing packages from the whole stream

This example shows how to remove all packages from the module stream.

Procedure

  1. Install the php:7.3 module stream, including all available profiles:

    [root@rhel-8 ~]# yum module install php:7.3/*
    Updating Subscription Management repositories.
    Last metadata expiration check: 0:20:19 ago on Tue Mar  3 11:32:05 2020.
    Dependencies resolved.
    =========================================================================
     Package          Arch   Version                              Repository                        Size
    =========================================================================
    Installing group/module packages:
     libzip           x86_64 1.5.2-1.module+el8.1.0+3189+a1bff096 rhel-8-for-x86_64-appstream-rpms  63 k
     php-cli          x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 3.0 M
     php-common       x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 663 k
     php-devel        x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 735 k
     php-fpm          x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 1.6 M
     php-json         x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms  73 k
     php-mbstring     x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 610 k
     php-pear         noarch 1:1.10.9-1.module+el8.1.0+3189+a1bff096
                                                                  rhel-8-for-x86_64-appstream-rpms 359 k
     php-pecl-zip     x86_64 1.15.4-1.module+el8.1.0+3189+a1bff096
                                                                  rhel-8-for-x86_64-appstream-rpms  51 k
     php-process      x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms  84 k
     php-xml          x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 188 k
    Installing dependencies:
     autoconf         noarch 2.69-27.el8                          rhel-8-for-x86_64-appstream-rpms 710 k
    ...
    Installing weak dependencies:
     perl-IO-Socket-IP
                      noarch 0.39-5.el8                           rhel-8-for-x86_64-appstream-rpms  47 k
    ...
    Installing module profiles:
     php/common
     php/devel
     php/minimal
    Enabling module streams:
     httpd                   2.4
     nginx                   1.14
     php                     7.3
    
    Transaction Summary
    =========================================================================
    Install  73 Packages
    
    Total download size: 76 M
    Installed size: 220 M
    Is this ok [y/N]: y
  2. Remove all packages from the php:7:3 module stream:

    [root@rhel-8 ~]# yum module remove php:7.3 --all
    Updating Subscription Management repositories.
    Last metadata expiration check: 0:21:26 ago on Tue Mar  3 11:32:05 2020.
    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

5.2.2. 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, including their dependencies, with the exception of packages required by a different profile.

Prerequisites

  • The selected profile has been installed using the yum module install module-name:stream/profile command or as a default profile using the yum install module-name:stream command.
  • You must understand modular dependency resolution.

Procedure

  1. Uninstall packages belonging to the selected profile:

    # yum module remove module-name:stream/profile

    Replace module-name, stream, and profile with the module, stream, and profile you wish to uninstall.

    Alternatively, uninstall packages from all installed profiles within a stream:

    # yum module remove module-name:stream

    These operations will not remove packages from the stream that do not belong to any of the profiles.

  2. Check the list of packages under Removing: and Removing unused dependencies: before you proceed with the removal transaction.

To remove all packages from a selected stream, follow instructions in Section 5.2.1, “Removing all packages from a module stream”.

Example 5.2. Removing packages from a selected profile

This example shows how to remove packages belonging only to a selected profile.

Procedure

  1. Install the php:7.3 module stream, including all available profiles:

    [root@rhel-8 ~]# yum module install php:7.3/*
    Updating Subscription Management repositories.
    Last metadata expiration check: 0:08:41 ago on Tue Mar  3 11:32:05 2020.
    Dependencies resolved.
    =========================================================================
     Package          Arch   Version                              Repository                        Size
    =========================================================================
    Installing group/module packages:
     libzip           x86_64 1.5.2-1.module+el8.1.0+3189+a1bff096 rhel-8-for-x86_64-appstream-rpms  63 k
     php-cli          x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 3.0 M
     php-common       x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 663 k
     php-devel        x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 735 k
     php-fpm          x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 1.6 M
     php-json         x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms  73 k
     php-mbstring     x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 610 k
     php-pear         noarch 1:1.10.9-1.module+el8.1.0+3189+a1bff096
                                                                  rhel-8-for-x86_64-appstream-rpms 359 k
     php-pecl-zip     x86_64 1.15.4-1.module+el8.1.0+3189+a1bff096
                                                                  rhel-8-for-x86_64-appstream-rpms  51 k
     php-process      x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms  84 k
     php-xml          x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 188 k
    Installing dependencies:
     autoconf         noarch 2.69-27.el8                          rhel-8-for-x86_64-appstream-rpms 710 k
    ...
    Installing weak dependencies:
     perl-IO-Socket-IP
                      noarch 0.39-5.el8                           rhel-8-for-x86_64-appstream-rpms  47 k
    ...
    Installing module profiles:
     php/common
     php/devel
     php/minimal
    Enabling module streams:
     httpd                   2.4
     nginx                   1.14
     php                     7.3
    
    Transaction Summary
    =========================================================================
    Install  73 Packages
    
    Total download size: 76 M
    Installed size: 220 M
    Is this ok [y/N]: y
  2. Remove packages from the devel profile:

    [root@rhel-8 ~]# yum module remove php:7.3/devel
    Updating Subscription Management repositories.
    Last metadata expiration check: 0:09:40 ago on Tue Mar  3 11:32:05 2020.
    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

5.3. Resetting module streams

Resetting a module is an action that returns all of its streams to their initial state - neither enabled nor disabled. If the module has a default stream, that stream becomes active as a result of resetting the module.

Procedure

  • Reset the module state:

    # yum module reset module-name

    The module is returned to the initial state. Information about an enabled stream and installed profiles is erased but no installed content is removed.

5.4. Commands for removing content

This section lists commonly used commands for removing content.

Command list

Remove a package
# yum remove package
Remove packages from an installed profile
# yum module remove module-name:stream/profile
Remove all packages from an active stream
# yum module remove --all module-name:stream
Reset a module to the initial state
# yum module reset module-name
Disable a module and all its streams
# yum module disable module-name