How to use the yum package manager like a Ninja

Yum (yellowdog update modifier) is the main package manager for Fedora. It downloads the binaries, installs the package and fixes the dependencies. Yum uses rpm (in background) to install packages.

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

Tagged with: , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!