Essential Yum Commands

Essential Yum Commands

·

3 min read

For an administrator, mastering yum, the ubiquitous package manager in Red Hat and Fedora systems, is like wielding a magical wand. Its vast array of commands can install, update, remove, and query software packages, keeping your systems optimized and humming along. But navigating this power can be daunting. Fear not, fellow wizards! This guide will equip you with essential yum commands, distilled for maximum practicality and simplicity.

Installing with Confidence:

  • yum install [package_name]: This basic incantation summons the power of yum, installing the specified package. Need Apache? Cast yum install httpd.

  • yum install [package_name].[architecture]: For specific architecture needs, append the architecture (e.g., x86_64) after the package name.

  • yum groupinstall [group_name]: Install entire groups of related packages with ease. Need a web server stack? yum groupinstall "Web Server" will conjure it.

  • yum install lifewire.com/rpm-file-2622217: Download and install directly from an RPM file with precise control.

Updates Made Easy:

  • yum update: Breathe new life into your system with a single command, updating all installed packages. A potent spell indeed!

  • yum update [package_name]: Update a specific package if you need targeted magic.

  • yum check-update: Before unleashing the update storm, use this incantation to see which packages are ready for renewal.

Uninstallation with Precision:

  • yum remove [package_name]: Banish unwanted packages with this command. Remember, with great power comes great responsibility!

  • yum erase [package_name]: For a more forceful removal, including configuration files, wield this powerful spell. Use with caution!

Knowledge is Power:

  • yum info [package_name]: Uncover the secrets of any package with this information spell. Learn its version, dependencies, and more.

  • yum search [keyword]: Seek out the perfect package within the vast repository with this powerful search charm.

  • yum repolist: List all the repositories your system knows about, like a master librarian.

Bonus Spells for Advanced Magicians:

  • yum-groups-manager: Manage package groups with finesse, creating custom collections for specific needs.

  • yumdownloader [package_name]: Download only a package without installing it, like capturing a magical ingredient.

  • yum clean [cache/all]: Clean up the remnants of past spells, clearing caches and optimizing your system.

Remember, with great power comes great responsibility. Always test commands in a safe environment before unleashing them on critical systems. And remember, the true magic lies in your understanding and skill. Explore the vast compendium of yum commands, refine your incantations, and become a master of your Red Hat domain!

Harnessing the Power of Upgrades and History:

  • Upgrade Your Way to Excellence:

    • yum upgrade: Ascend to the next level by upgrading all packages to their latest available versions.

    • yum upgrade [package_name]: Target a specific package for a focused upgrade.

    • Caution: While yum upgrade is often used, it's technically intended for upgrading packages within a major release. To upgrade to a newer major release, use yum distro-sync.

  • Mastering Your Past with History:

    • yum history: Recall the chronicles of yum commands, revealing past transactions and their details.

    • yum history info [ID]: Delve deeper into a specific transaction's secrets by providing its ID.

  • Undoing the Unwanted:

    • yum history undo [ID]: Reverse a previous transaction, undoing its actions.

    • yum history rollback [ID]: Revert all transactions back to a specific point in time, using the specified transaction ID as the rollback point.

Sample output for yum history:

ID     | Command line                            | Date and time    | Action(s)      | Altered
-------|------------------------------------------|-------------------|----------------|---------
   93 | install vim-enhanced                       | 2023-07-21 14:15 | Install        |    1   
   92 | install httpd                             | 2023-07-21 14:05 | Install        |    1   
   91 | remove nano                               | 2023-07-20 16:30 | Remove         |    1   
  <...>

Sample command for rollback:

yum history undo 93

Notes to Remember:

  • Exercise caution when using yum upgrade or yum history undo, especially on critical systems. Test in a safe environment first.

  • For more complex rollbacks or recovery scenarios, consider using system snapshots or configuration management tools.

  • Regularly consult yum's official documentation for comprehensive guidance and the latest command options.