Linux Lab: How To: Use the YUM Package Manager

YUM is a package manager for RPM based Linux Distributions. Users will be able to install, remove,search for, upgrade and verify packages. YUM also tells the user about unresolved dependencies. If you are using Fedora, use DNF not YUM

basic formula

The basic formula for yum, is:

yum <command name> <package name>

packages available to me

To list all available packages that are on the repositories and also all of the packages that are on the system use the command:

yum list

If you just want to check out what packages you have installed on the system use:

yum list installed

repositories

YUM is able to know where to download packages from, because of the repository list that is at /etc/yum.repos.d/. The listed repositories are the default ones for the OS that you are running. However you can add other repositories.

Adding repositories and installing software from unverified or untrusted authors is a security risk. A risk that can lead to maintainability, stability and compatibility issues.

To add a new repository, use the command as root:

yum-config-manager --add-repo

example:

sudo yum-config-manager --add-repo http://www.example.com/example.repo

To enable the repository, one must first find the unique repository ID that the repository uses. To do this use the command:

yum repolist

example:

Once you have found the unique ID enable the repository by using the command:

yum-config-manager --enable <IDname>\*

example:

yum-config-manager --enable nginx\*

The \* will enable all repositories pertaining to the ID name.

updating packages

Do my packages need updating? To check if any of the packages on your system require any updates use the command:

yum check-update

yum will output the package name, the version and the repository from which the software is from off all packages that need updates.

If you would like to update ALL of the packages on your system, use the command:

yum update

If you want to update just one package, add the name of the package after the command yum update:

yum update <package name>

example:

yum update leafpad

If you would want to update ALL packages but one, use the --exclude=package flag. I do not want to upgrade xorg, so the example is:

yum --exclude=package xorg* update

Yum will update all of the packages but the packages pertaining to xorg.

searching for packages

To search for a package use the command:

yum search <package name>

example:

yum search firefox

yum will list the packages pertaining to Firefox, and will bold your search word in the package name and the description of the package name.

If yum could not find anything yum will display:

Warning: No matches found for: <package name>
No matches found

Either search for the package that you want in general or give up as the package that you are searching for is not in the repository. A common mistake that people make, is that if they do a search with the wrong package name. Many, when wanting to search for the chrome web browser enter:

yum search chrome

They will then see the output

Warning: No matches found for chrome
No matches found

This is because chrome is not available as a package, because it is not called chrome, rather it is called google-chrome-stable, for the stable version, google-chrome-beta for the beta version and google-chrome-unstable for the unstable version. If you did not know the package name it is best to search for the generalization of what you want. If I did want chrome I would search for:

yum search web browser

From their I would scroll thru the list till I found the name chrome.

(Note this was an example, out of the box you can not download Chrome/Chromium due to conflicts, if you want to install Chrome/Chromium you have to add in a repository.)

install packages

Installing a package is as easy as:

yum install <package name>

example:

If their are dependencies that are needed for your package to operate, you will be presented with a chart containing the names, versions, package size as well as location to the packages that will need to be downloaded. It will also tell you if their is a dependency the needs updating. To continue with the download and install, hit the "y" key, to deny the install hit the "n" key.

In this picture, you can see that it will install the application that we told it to under the heading Installing: YUM informs us that we have unmet dependencies and lists them under the heading Installing for dependencies:. We know that we will be getting the 64 bit versions off all of the packages thanks to YUM informing us under the heading Arch we also know the version of the packages YUM will be giving us as well as the name of the repository, which in this example is r1soft. YUM also tells us the size each package is in terms of download size.

Under transaction summary it tells us the number of packages that will be installed and the number of packages that need updating, it also tells us the total download size and the total size of space that will be used after install. Finally it asks for our permission.

If you would want to install a package and remove another package, instead of using two commands, you can easily do it in one. Use the command:

yum swap <package name> <package name>

example:

yum swap <leafpad> <geany>

yum will remove leafpad and install geany. It is important to note that the first package name you give yum will be the package that will be removed.

remove packages

To remove a package use the command:

yum remove <package name>

example:

yum remove geany

yum errors and how to resolve them

  • If you are trying to install packages with yum install and during the output you see something along the lines of The requested URL returned error: 404 Not Found. Trying other mirrors' their is something wrong with the metadata that was downloaded. Mostly because YUM has an outdated metadata file. To repair 404 errors, runsudo yum clean metadata`.

  • If you are downloading a package and see 'Metadata file does match checksum. Trying other mirror, this can also be cause caused by metadata issues. To resolve run sudo yum clean metadata.

It should be noted that if your using fedora use dnf not yum, most of the commands can be done by just replacing yum with dnf.

1 Like

Indeed, I will add that.

Good stuff. Thanks for the write up.

Thanks for this ! I have been on Ubuntu based distro a short while, so I was looking to run Fedora a bit.

If you do plan on using Fedora, use a version older then 22. As 22 on wards uses a new package manager called DNF. Most of the YUM commands are the same for DNF but some are different. CentOS still uses YUM tho and basically a cousin to Fedora.

Im sorry.. No. Dont do this. Use the current version Fedora 23. Don't use an older version because its using an older package manager. Just be aware the command has changed slightly, the switches/options for the most part haven't changed

I said that because I thought that Fedora had a longer support for their distros. But looking on their website, they only support a distro for 13 months. So the only supported versions are 22 and 23. I thought they supported their distros for 2 years (24 months)

I tried Fedora 23 last night on my Dell Laptop. Runs good. Tried it on my Desktop and runs like crap... :\

Laptop: Intel i5-3337U 2.7Ghz| 6GB Ram | 500GB HDD
Desktop: Intel i5-4690k 4.3Ghz | 12GB Ram | 850 EVO 250GB | 1TB WD Blue |

Going for round 2 tonight

On your Desktop, is it just the GUI that is slow or is everything slow? Also it would be nice to see the output from top. How much CPU is being used with nothing open, and how much CPU and RAM is used while moving a window around on the screen. If you are using Gnome, their are all sorts of posts of people complaining about poor performance with Gnome on Fedora. Most of the time it is fixed with using proprietary graphics drivers.

Best of luck on Round 2! Make sure to go Holly Holm on it.

1 Like

Tried running from the intel graphics to see if the problem persists?

not yet, but I will consider it if I can't get it going link it should

It was "lagging" for lack of a better word. But I know that was my first experience with it, I've done some research now and will try some different configs in about an hour.

rpmfusion provides the proprietary nvidia drivers. the open drivers are improving but on nvidia there not great for 3d last time I used them (which was a while ago)

edit: a word

1 Like