Login | Register RSS

Package Management Basics - Part 1

In this day and age, Linux package management has become much easier.  But for those just starting with Linux, it may initially appear to be a daunting task to effectively manage your system's packages (i.e. installed applications). For those users running Fedora or CentOS Linux, this tutorial should help you quickly and effectively master the basics.  For the most part, we will guide you through how to use the 'yum' and 'rpm' commands to accomplish this task.  After the basics are covered, we will expand into a few advanced package management commands that you may also find useful.

Here is how the tutorial will break down:

  1. Patching your system
  2. Listing available packages
  3. Search for & get descriptions of packages
  4. Installing new packages
  5. Obtain list of installed packages
  6. Removing installed packages
  7. Advanced package management commands

* 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. 

Without any further delay, let's get going...

Patching your system:

This is probably the most important command you will ever learn, as it will apply patches & updates to the packages that are currently installed.  This helps with your system's stability & security.  Both commands should be run in the order they are specified below.

yum --skip-broken update;
yum --skip broken upgrade;

The first command tries to patch your installed packages.  This helps ensure the existing configuration settings of the given packages are preserved.  The second command upgrades any packages, which the update command could not patch.  The upgrade process may reset the existing configuration settings of the given package.  Usually the update handles everything & the upgrade find nothing; however it's good practice to use both commands to ensure everything that can be patched, is effectively patched.

You may have noticed that I like to use the '-- skip-broken' attribute (many tutorials won't tell you to do this). This attribute tells yum to go ahead with those packages that are ok to update/upgrade.  This lets yum skip over those packages that have unresolved dependency issues or other problems.  Without this yum would not update/upgrade anything, should a single package within the group have a problem.  Overall this keeps your system as current as possible, while problem issues are worked on.

On a side note, if you are going to cron or automate these commands, I would recommend you also include the '-y' attribute before the '--skip-broken' attribute.  This will automatically answer yes to all approval questions that yum would typically ask (such as whether it's ok to proceed & if a new/updated gpg key should be accepted.)  As long as you stick to using quality/popular rpm repositories, applying this attribute should not be an issue.  Here is an example how the above commands would look with the '-y' attribute.

yum -y --skip-broken update;
yum -y --skip broken upgrade;

In the next installment, we will cover how to list packages available for your given 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
Latest Blog Posts:
Latest Q&A Posts:

© 2017 BuildDesignCreate.com • All Rights Reserved
Privacy PolicyAdvertise with UsContact UsSite Map