Package Management Basics - Part 6
Login | Register RSS

In this installment of our Linux package management basics tutorial, we will be covering how to remove packages from your specific system.  This will teach you the different ways to uninstall packages that you no longer need.

* NOTE: All of the example commands below assume you are performing them as 'root' or some other authorized administrative user.  You can also perform these commands through 'sudo', if you do not wish to login directly as 'root'.  To do this via 'sudo', simple prepend the word 'sudo', followed by a space, before the given command.

Removing installed packages:

* IMPORTANT NOTE: Removing currently installed packages is very serious business.  You should never remove any package you do not know about.  Also be careful of what packages the system wants to automatically remove alongside with the ones you specified.  If you allow removal of the wrong packages, you could cause your system to crash or become unusable.  Use these commands at your own risk & always make sure you have working backups of your system/data before removing anything.

Removing an installed package via 'yum' is very straight forward.  You simply need to know the package name, which can be obtained from the yum list commands.

To remove a package installed to your system, use this command:

yum erase PACKAGENAME;

Where 'PACKAGENAME' in the above command is simply the name of the package you noticed in the yum list (entered in the case it's shown).  In current versions of yum, it should automatically find & remove dependency packages that are no longer required by other packages within your system.

* Side Note: You should check to see if there is a package called "yum-plugin-remove-with-leaves" to install. If there is one for your specific Linux distro version, you should install it.  This will give allow yum to remove the unused dependency packages for you, when you remove a given package.  This helps prevent he creation of  orphaned packages (which are packages installed to your system that are no longer used - which we will touch more upon later).  If you do not see this package, your version of yum likely already performs this check for you.

If you want to remove multiple packages at one time, you can space separate them in the same command.  For example, if you have 3 packages to remove, your command would look like this:

yum erase PACKAGENAME1 PACKAGENAME2 PACKAGENAME3;

Just so it's noted, you can also remove packages using 'rpm', but it will only remove the given package specified, when there are no other package still requires it.  It will not remove dependency packages that are no longer needed.  The command to do that is:

rpm -e PACKAGENAME;

Where 'PACKAGENAME' is the given package name/version that shows in your 'rpm' command specific list of installed packages.

In the next installment, we will move onto some of the more advanced package management abilities, that will help you better maintain your system.

If you like this site or any of its content, please help promote it. Use the social media buttons below to help spread the word. Don't forget to post in the comments section.

  Print   Email