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>
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 ofThe 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, run
sudo 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
.