Yum
From SysadminWiki
yum.conf
We can use YUM to detect the distribution and the architecture. In this way we can maintain a unique release/architecture independent file instead of many different versions. This simplifies also the fabric management part. For example if you use Cfengine you don't have to maintain special classes to handle different yum.conf files.
Modify yum.conf (see example) to include in the main section
distroverpkg=distro-release
See tips to know what the value of your distro-release should be. This will enable to use $releasever yum variable in the yum.conf urls together with $basearch.
The naming scheme of the directories on the software server has to conform to what yum wants to see. For example a directory /path/external can have subdirs
sl3/i386 sl4/i386 sl4/x86_64
and then for each specific release version that we use we just add a link to the correct sl directory. So for example we can have something similar
/path/external/3.0.3 -> sl3 /path/external/3.0.7 -> sl3 /path/external/4.4 -> sl4
the same can be created for the OS
/path/SL/3.0.7 -> /anotherpath/SL3/Mirror/307 /path/SL/3.0.8 -> /anotherpath/SL3/Mirror/308 /path/SL/4.4 -> /anotherpathSL4/Mirror/44 /path/SL/4.5 -> /anotherpath/SL4/Mirror/45
and for other software like the glite software below:
/path/glite/3.0.7 -> /athirdpath/glite3.0 /path/glite/4.4 -> /athirdpath/Glite-3.1/generic/sl4 /path/glite/4.5 -> /athirdpath/Glite-3.1/generic/sl4
Now we just have to maintain the links which is rather easier than maintaining a file for each release and architecture.
yum.conf example
This is an example of yum.conf corresponding to the above structure:
[main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest tolerant=1 exactarch=1 distroverpkg=sl-release [slserver] name=SL $releasever base baseurl=http://<your-server>/path/SL/$releasever/$basearch/SL/RPMS/ [slerrata] name=SL $releasever errata baseurl=http://<your-server>/path/SL/$releasever/$basearch/errata/SL/RPMS/ [local-external] name=Local Ext baseurl=http://<your-server>/path/external/$releasever/$basearch/ [glite] name=Glite Mirror baseurl=http://<your-server>/path/glite/$releasever/$basearch/ [lcg-CAs] name=LCG CAs baseurl=http://<your-server>/path/lcg-CA
tips
distroverpkg has to match the package name to which the file /etc/redhat-release belongs not the name of the file itself. If the name doesn't match the variable $releasever will be assigned a Null value and yum will complain of not finding the directory. To know what is the name of the package use:
rpm -qf /etc/redhat-release
in the examples above the package name was sl-release. See yum and yum.conf man pages for more information.
