Yum repositories on RHEL – CentOs Cheatsheet November 15, 2010Posted by Tournas Dimitrios in Linux.
Yum is just a front end for the rpm – package management .If you use a version of Linux that comes with Yum, you are more than likely familiar with it. For those of you who aren’t, it’s a program that can either be ran with or without a GUI and that is made to install, remove and update packages on a system. This article demonstrates the basic commands that I use to handle packages and repositories on my CentOs box ..
|Basic Yum commands|
|Is a software already installed on my system ?
yum list install software-name
yum list install software-name1 software-name2
|Installing with yum : yum install PACKAGE-name|
|Installing local rpm’s with yum : yum localinstall PACKAGE-name
Is used to install a local rpm file . If required the enabled repositories will be used to
|Search for software : yum search software-name or *string|
|Updating software : yum update PACKAGE-name|
|Uninstalling software : yum remove PACKAGE-name|
|List available updates for installed packages:yum list updates|
|Update the whole system: yum update|
|Find out which package a file belongs to: yum provides ‘foo’|
|Yum has package groups that install big clumps of stuff at once. You can see a list of these:yum grouplist
These are managed with almost the same commands as individual packages, with the group’s name enclosed in single quotes: yum groupinstall ‘name of grouplist’ , yum groupupdate ‘ name of grouplist ‘
yum groupdelete ‘name of grouplist’
|Run automatic daily updates:chkconfig –level 345 yum on; service yum start|
By default, Yum queries your remote repositories every single time you run it, which are listed in /etc/yum.repos.d. This can get boring pretty quickly because it takes time to download fresh package lists. An alternative is to create a local Yum cache. To do this, add this line to /etc/yum.conf: keepcache=1 Then run yum -C ‘options’ when you want to hit the local cache instead of fetching fresh data.
Installing a repository on your Yum repository list is made through the rpm command , read this article for a detailed description .These files/directories are important to notice :
- /etc/yum.conf : main configuration file
- /etc/yum/yum-updates.conf : Configuration file for enable/disable automatic update/installation
- /etc/yum.repos.d/ : home dir for all your repos
- /etc/pki/rpm.gpg/ : this dir contains the keys of all installed repos
- /var/log/yum.log : Yum creates an index of installation/update/delete of a package . It is a handy way to find when a package was installed / deleted from our box : less /var/log/yum.log | grep -i nagios .This reveals all information when nagios was installed / updated / and or removed .
The following table lists the commands that can be used to manipulate the Yum repositories :
|Handling your Yum repositories (click on thumbs)|
Handling groups of packages :
Some applications or development environments are made from many packages . For example the KDE desktop environment is made of 22 packages . So instead of handling these packages separetaly , during installing or removing of KDE , yum provide us with nice utilities to handle these packages as a whole .
|yum grouplist||List all available package groups|
|yum groupinfo [Name of package group]||Displays information for a specific package group|
|yum groupinstall [Name of package group]||Installing of a package group|
|yum groupremove [Name of package group]||Removing of a package group|
Find out from what repo your installed packages are :
Sometimes it is necessary to know from what repository a specific package is installed . The package “yum-utils” contains the ” repoquery ” command that get for us this information . First install the package with the following command : ” yum install yum-utils ” .
Cleaning the catche of Yum
The yum package manager maintains a cache of headers and files in /var/cache/yum. Remove obsolete packages, free up disk space this is a really important to run these commands mentioned here in this post to keep your system performing really good and reduce lagging time for installing updates.
This guide is for distributions using yum package installer “RPM package manager” like Fedora, CentOS and openSUSE.
Pros and Cons :
Pros: Removing unneeded packages will improves machine performance and Free up disk space.
Cons: Removing this packages you might need in the future, sometimes you need it in case you have similar broken packages to replace with, just to save some time for installing it directly from old ons instead of downloading those packages again.
By default, yum retains the packages and package data files that it downloads, so that they may be reused in future operations without being downloaded again. To purge the package data files, use this command:
$ yum clean headers
Run this command to remove all of the packages held in the caches:
$ yum clean packages
To clean the metadata files use this command:
$ yum clean metadata
This cache can grow rather large over time, and can be cleaned with the yum “clean” option. Clean all cached files and packages from active repository.
$ yum clean all
When using these commands, at the prompt, enter the password for the root account.
*Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.*
- Yum and RPM Tricks
- yum manuals
- How To Download a RPM Package Using yum Command Without Installing On Linux