06. Installing packages with dependencies yum

An easier way to install packages with their dependencies is through the yum command. This pulls in any packages from its list of known repositories. Simply specify the package you want and it'll pull in all the necessary dependecies for you and download them.

dnf has replaced the command yum since Fedora 22 versions. If you're using any Fedora versions before 22, you should read through this page - otherwise, skip to the next lesson.

Origins

The yum command originally came from the Yellow Dog Linux distribution. It was used by distros such as Fedora, SUSE and Mandriva.

Syntax

The yum command comes with actions that specify a command, and options for fine-tuning. The syntax is as follows:

# yum [options] [action] [package]

Actions

Here are a list of actions that are used with the yum command.

install
Install package and its dependencies if any are missing.
check-update
Check to see which packages have any updates available.
update
Update the specified packages, or update all if no packages are specified. Note that it's similar to apt-get upgrade.
upgrade
Delete any packages that are obsolete. Same as update with the --obsoletes flag.
remove|erase
Delete the specified package from the system, including any of its dependencies.
list
Displays information about a package - including version number and whether an update is available.
search
Search through the repository for keywords included in the package name and description. Use this to identify the exact package name when knowing just a keyword.
info
Shows information regarding a package.
clean
Clears out the yum cache directory.
localupdate
Updates system.
localinstall
Installs RPM files using Yum.
deplist
Shows a list of dependencies for a specified package.

Example Installation

Installing a package is easy as just one step! All dependencies will be pulled in automatically.

 # yum install ninvaders
Yum command has been deprecated, redirecting to '/usr/bin/dnf install ninvaders'. See 'man dnf' and 'man yum2dnf' for more information. To transfer transaction metadata from yum to DNF, run: 'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate' Last metadata expiration check performed 2:10:26 ago on Mon Dec 28 12:03:27 2015. Dependencies resolved. ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: ninvaders x86_64 0.1.1-12.fc23 fedora 37 k Transaction Summary ============================================================================= Install 1 Package Total download size: 37 k Installed size: 87 k Is this ok [y/N]: y Downloading Packages: ninvaders-0.1.1-12.fc23.x86_64.rpm 35 kB/s | 37 kB 00:01 ----------------------------------------------------------------------------- Total 22 kB/s | 37 kB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Installing : ninvaders-0.1.1-12.fc23.x86_64 1/1 Verifying : ninvaders-0.1.1-12.fc23.x86_64 1/1 Installed: ninvaders.x86_64 0.1.1-12.fc23 Complete!

Yum alternatives

If you need to just download a package (and not install it) you may use the yumdownloader command.

For a GUI front-end to yum, consider using kyum or yumex. You may need to install these using a yum command from above.

Configuration files

The yum configuration file lists where to find repositories as well as where all downloaded packages should go, along with access logs settings. The configuration file is located in /etc/yum.conf and the directory /etc/yum.repos.d.

Take your Linux skills to the next level!

System Admin Handbook

Take your Linux skills to the next level! Try Linux & UNIX

This book approaches system administration in a practical way and is an invaluable reference for both new administrators and experienced professionals. It details best practices for every facet of system administration, including storage management, network design and administration, email, web hosting, scripting, and much more.

$ Check price
74.9974.99Amazon 4.5 logo(142+ reviews)

More Linux & UNIX resources

Want to avoid becoming a code monkey?

Clean Code

Want to avoid becoming a code monkey? Try Good Practice

Software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship. Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code "on the fly" into a book that will instill within you the values of a software craftsman and make you a better programmer.

$ Check price
49.9949.99Amazon 4.5 logo(427+ reviews)

More Good Practice resources

Ad