Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 5. Removing RHEL 8 content

In the following sections, learn how to remove content in Red Hat Enterprise Linux 8:

5.1. Removing installed packages

To remove a package installed on your system, complete the following steps.

Procedure

  • To remove a specific package, use:

    # yum remove package-name

    Replace package-name with the name of the package you want to remove.

    Note

    The yum command removes a package 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 removes 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, yum removes all packages with a name corresponding to the packages installed by the stream. This includes packages' 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 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 want 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 Removing packages from an installed profile.

Example 5.1. Removing packages from the whole stream

The following is an example of how to remove all packages from the php:7.3 module stream.

Procedure

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

    # 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. Inspect the php module:

    $ yum module info php
    ...
    Name             : php
    Stream           : 7.3 [e] [a]
    Version          : 8020020200715124551
    Context          : ceb1cf90
    Architecture     : x86_64
    Profiles         : common [d] [i], devel [i], minimal [i]
    Default profiles : common
    ...
    Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive
  3. Remove all packages from the php:7.3 module stream:

    # yum module remove --all php:7.3
    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
  4. Inspect the php module after the removal:

    $ 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

The 7.3 stream of the php module is currently enabled but no packages from this streams are installed.

5.2.2. Removing packages from an installed profile

When you remove packages installed with a profile, yum removes all packages with a name corresponding to the packages installed by the profile. This includes package dependencies, with the exception of packages required by a different profile.

Prerequisites

  • The selected profile has been 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.
  • You 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 want 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 Removing all packages from a module stream.

Example 5.2. Removing packages from a selected profile

The following is an example of how to remove packages and their dependencies that belong to the devel profile of the php:7.3 module stream.

Note

The outputs in this example have been edited for brevity. Actual outputs might contain more information than shown here.

Procedure

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

    # 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. Inspect the installed profiles:

    $ yum module info php
    ...
    Name             : php
    Stream           : 7.3 [e] [a]
    Version          : 8020020200715124551
    Context          : ceb1cf90
    Architecture     : x86_64
    Profiles         : common [d] [i], devel [i], minimal [i]
    Default profiles : common
    Repo             : rhel-AppStream
    ....
    Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive

    All profiles are installed as indicated in the output.

  3. Remove packages from the devel profile:

    # 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
  4. Inspect the installed profiles after the removal:

    $ 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

    All profiles except devel are currently installed.

5.3. Commands for removing content

The following are the commonly used commands for removing content in Red Hat Enterprise Linux 8.

CommandDescription

yum remove package

Remove a package.

yum module remove module-name:stream/profile

Remove packages from an installed profile.

yum module remove --all module-name:stream

Remove all packages from an active stream.

yum module reset module-name

Reset a module to the initial state.

yum module disable module-name

Disable a module and all its streams.