Since the blogpost “Setting up yum on SUSE LINUX 10.0” was the most successful article I’ve ever written I decided to continue the story with an article about the new version of Suse Linux, version 10.1. This time I added the update repository which was not provided last time I wrote the other HowTo. But sequential:
What and why?
yum is the “Yellow dog Updater, Modified” [(Homepage), (yum wiki), (Wikipedia)]. It is an command line application to manage rpm packages. It is comparable to urpmi, apt, smart (command line part) and yast (the software management part).
It is well known and much used in the Fedora/CentOS world and is therefore interesting for people migrating from some of these solutions. Additionally it is nice to handle and has some advantages over yast which make it also interesting for Suse users.
The advantages of yum are quite a lot:
- It can change to new mirrors on the fly out of a internet based mirror list.
- Package signature tests, the keys can be downloaded from a given internet address.
- It is capable of multi-arch support (interesting for x86_64 users).
- It has a plugin api.
The first point is one of the strongest advantages: when your usual mirrors brakes down yum jumps to another one (chosen by chance) which make it very smooth to use the tool even if there are heavy problems with some of the main mirrors. It also balances the load on the servers.
The second one adds a tiny bit more of security – why not use it as long as it is available. The third one is something no other tool really supports at the moment (apt does not, for example; the apt-rpm port does at the moment in the newest version though!). It gives you the ability to easily install x86 pacakges on x86_64 machines.
And with the plugin api you can “pimp up” your package management, more about that later.
The disadvantage is that yum depends on XML Package Metadata. These metadata information have to be created for each repository. While this step is quite easy it is a step which has to be done since yast depends on its own repository format.
Since the XMLPM format is a kind of an standard already the main Suse repositories are provided with these so called “repodata”: Suse base, non-oss, updates and also packman have these repodata and can be accessed by yum. Other Suse yast repositories like the most project repositories are not yet supported, unfortunately. So you can use yum to manage the usual Suse stuff and also the “needed” stuff like packman, but the most suse projects and other additional repositories cannot be accessed by yum.
Today all Suse repositories rely on the XML package metadata format. It became the standard format of all Suse software management tools, and therefore yum can use all repositories around today.
How to configure it – theory
The repository configuration files for yum are in
/etc/yum.repos.d/. A file is called
something.repo and should look like this (online version):
name=Suse Linux - Base Repository
The first line identifies the repository, the second line gives a human readable name, the third line, here commented out, is the path to the server which should be used, the fourth line provides a mirror list (which works instead of a direct server link), the fifth line says if this repo should be used, the sixth line activates the gpg signature checking, and the seventh line tells yum where to get the key.
A note: I use the variable
$releasever here which makes the files usable on every Suse version, not only 10.1. But since Suse dropped the “OSS”-part of the name between 10.0 and 10.1 and not every repository named the directories in the right way these configuration files may or may not work with Suse 10.0. But they should work with Suse 10.2 and higher – if the name is not changed again in a strange way.
Other basic settings can be found in yum’s main configuration file:
/etc/yum.conf. This is not interesting here, the defaults are ok.
How to set it up – reality
First: install yum somehow – one way would be to start the yast software management, and search it there, it is provided by Suse. The next step are the repositories: Since I already configured my system, all you have to do is to copy my files into the
/etc/yum.repos.d/ repository. Unfortunately Suse/Novell does not provide a mirror list, so at the moment the system will use a mirror list saved at my university server. Keep in mind that I will not stay at the university forever, so these lists can disappear suddenly. If someone can host them for a long time, please drop a note. Also, if you want me to add other servers to the list, drop me note here at the comments or contact me on jabber.
One word about the packman repository: I deactivated the gpg signature test since they often had problems with this topic in the past, and a first test showed that not all packages are signed which causes yum to stop when the signature test is activated. If you have problems with specific packages for this repository, use the exclude function as mentioned above to avoid these packages, and check back a day or two later.
How to use it
The usual commands are pretty easy:
- yum install foo – install package foo
- yum remove foo – remove package foo with dependencies
- yum search whatever – search for this string
- yum update – update the whole system
- yum update foo – update only package foo
- yum –exclude=foo update – update the whole system except foo
- yum info foo – give the infos about this pacakge
- yum provides foolibrary – which pacakge has this library?
- yum clean all – clean cached data
Experts, part one: personal repositories
If you want to provide your own repository or want to access a local repository for instance because you rsync data with a non-XMLPM repository, you have to create the necessary repository files.
createrepo, which is again provided by Suse, will do this job. If you have already set up yum you can easily install
createrepo with the command
yum install createrepo.
After this, copy all the rpm-files you want to use to a special place:
mv *.rpm /var/cache/myrepo
/var/cache/yum/myrepo will appear a new directory called repodata. Now place the
*.repo file in
name=my cool repo
Experts, part two: plugins
With plugins you can easily pimp up yum. Some examples are:
installonlynwhich deletes the oldest kernel when a newer one is installed, making sure that there will be not more or less than n kernels installed.
fastestmirrorto identify the fastest mirror so that only this one will be used for the repositories. This speeds up the download of packages without any interacting with you.
changelogwhich shows the changelog of every updated package before or after installing.
versionlocklocks the version of specific packages.
There are other plugins, and since everything is documented it should be quite easy to write own plugins.
To use the plugins, first set the option
plugins=1 in your
/etc/yum.conf. After that, create the directories
Now you can download any plugin you want from the yum plugin page into the directory
/usr/lib/yum-plugins. Each plugin file contains some information about configure options. These should be usually copied as a file to
/etc/yum/pluginconf.d. For instance I have the file
/etc/yum/pluginconf.d/fastestmirror.conf which contains:
And it just works pretty nice. If you want to see it working, set the option
verbose above from 0 to 1 – it will list all checked mirrors together with the times.
So, enjoy yum on your new Suse. Thanks to Suse/Novell for providing XMLPM for the main and most important directories and for providing the yum and createrepo binaries. And, of course, thanks to the yum duke project!