In this guide, the latest version of CentOS is saved under the path /repo/cos5_x64 or /repo/cos54_x86 according to the architecture. If an older version of CentOS is also desired for a certain period of time, this default can ensure that the upgrade and update functionality is still available in the event of a jump in the CentOS version.

Attention 

When switching to a new version, please note that the current security updates are always made available on the mirror servers under the path /mirror/centos.org/5/updates/. This means that the update directories of your own repository have to be renamed to avoid package conflicts due to version differences. In my example, there was a change from CentOS 5.4 to version 5.5. With the hint from the previous sentence, for the outdated version 5.4 the previous directory would be renamed from /repo/cos5_x86 to /repo/cos54_x86 and then a new (empty) directory /repo/cos5_x86 with the subdirectories os and updates would be created.

Now the current updates can be synchronised again with the new directory /repo/cos5_x86, while the older CentOS version 5.4 continues to be available in parallel via its dedicated directory. Since new security updates are no longer distributed via this directory, older versions should not be used for productive use. The following structure is intended to better illustrate the structure of the paths, taking the release of version 5.5 as an example.

/repo/cos54_x64
os
updates
/repo/cos54_x86
os
updates

/repo/cos5_x64
os
updates
/repo/cos5_x86
os
updates

Via cron job and the shell script centosupdate.sh, the latest patches can be loaded daily from the CentOS mirror servers and are then available to all local servers or clients based on CentOS.

#!/bin/sh
#
# Author: Jens Mahnke (maj)
# This script gets the latest updates for CentOS 5 x64 and x86 from the
# CentOS mirror.
# Script is started nightly from root's crontab
#
# Source: http://ftp.hosteurope.de/mirror/centos.org/5.5/updates/x86_64/RPMS/
rsync='rsync -aqzH --delete --exclude-from=/repo/cos5.exclude ftp.hosteurope.de::centos/5.5/updates'
echo -e "\n*******************"
echo -e "START rsync X64"
date
echo -e "*******************\n"
$rsync/x86_64/RPMS/ /repo/cos5_x64/updates
echo -e "\n*******************"
echo -e "START rsync X86"
date
echo -e "*******************\n"
$rsync/i386/RPMS/ /repo/cos5_x86/updates
echo -e "\n*******************"
echo -e "START createrepo X64"
date
echo -e "*******************\n"
/usr/bin/createrepo -q /repo/cos5_x64/updates
echo -e "\n*******************"
echo -e "START createrepo X86"
date
echo -e "*******************\n"
/usr/bin/createrepo -q /repo/cos5_x86/updates
echo -e "\nDONE!!\n"

The associated exclude file.

+ openoffice.org-langpack-de*
+ openoffice.org-langpack-en*
openoffice.org-langpack-**
openoffice.org-sdk-**
repodata/

The following cron job calls the shell script described above daily at midnight.

0 1 * * * /usr/local/bin/centosupdates.sh >> /var/log/centosupdates 2>&1