Getting started with the yum package manager

Getting started with the yum package manager

In this tutorial we will learn about the topic  “Getting started with the yum package manager”.

Yum is the Red Hat package manager that is able to query for information about available packages, fetch packages from repositories, install and uninstall them, and update an entire system to the latest available version. Yum performs automatic dependency resolution on packages you are updating, installing, or removing, and thus is able to automatically determine, fetch, and install all available dependent packages.
Yum can be configured with new, additional repositories, or package sources, and also provides many plug-ins which enhance and extend its capabilities. Yum is able to perform many of the same tasks that RPM can; additionally, many of the command-line options are similar. Yum enables easy and simple package management on a single machine or on groups of them.

1. How to install packages with yum: yum install packagename

This will install the package and fix the dependencies.

$ sudo yum install nmap

You will be asked if you want to install the package, unless you use sudo yum -y install nmap.

2. How to remove packages with yum: yum remove packagename

This will uninstall the packages, but keep the config files.

$ sudo yum remove nmap

3. How to download the .rpm file, without installing it: yumdownloader packagename

The .rpm package will be downloaded in your current directory.

$ sudo yumdownloader nmap
$ ls nmap*

4. How to install local .rpm packages: yum localinstall packagename

This will install the .rpm package downloaded with yumdownloader:

$ sudo yum localinstall nmap*

5. How to update a package: yum update packagename

If the package exists, yum update will upgrate it. If it does not exist, yum will tell you that there are updates available, but the software is not installed.

$ sudo yum update nmap

To update the packagelist use: sudo yum check-update and to upgrade the whole system, use sudo yum update.

6. How to search for a package: yum search packagename

You can search for packages by both, name and description with the same command:

$ yum search pidgin

7. How to get info about a package: yum info packagename

After you find the package with “yum search”, you may need to get some extra information about it, before installing.

$ yum info nmap | grep -i size
Size : 2.7 M

8. How to search for packages by files inside the package: yum provides filename

This command will find me the package containing the sshd file:
$ yum provides sshd
openssh-server-5.8p2-25.fc16.x86_64 : An open source SSH server daemon
Repo : updates
Matched from:
Filename : /usr/sbin/sshd

9. How to display the repolist with yum: yum repolist

This will display the repos configured in the /etc/yum.repos.d/ file

$ yum repolist
repo id repo name status
fedora Fedora 16 - x86_64 25,098
updates Fedora 16 - x86_64 - Updates 9,108
repolist: 34,206

To verify if a package is installed or not, use rpm -qa | grep package.

$ rpm -qa | grep firefox

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

Enjoyed this video?
Getting started with the yum package manager
"No Thanks. Please Close This Box!"