Creating internal/local Centos 5 repository with rsync

Below is the bash script I use to mirror Centos repository into our local server. Due to storage limitation, we have to be selective and only copies the packages/branches that we need. Currently we only mirror Centos 5 for “os and updates” base packages limited to i386 and x86_64 architecture only.

During the initial intensive downloading when the server is replicating for the first time, I run the script below in cron for every 30 minutes. The script will check whether the previous instance is still running or dead (sometimes we got disconnected). If dead then it will restart and continue the rsync process. Once everything is in place and all needed packages have been downloaded, I modify the cron job to do the job once in every 6 hours to make sure my server is up to date.

The script below is inspired by the script posted here by jlar310

# created by Jalte @

DATE=`/bin/date +%Y-%m-%d`
RSYNC="/bin/nice /usr/bin/rsync --verbose --progress --delete-excluded --stats --archive --partial --timeout=600"
ARCHLIST="i386 x86_64"
BASELIST="os updates"

date >> /var/log/rsynccentos.log

if [ -f "/var/run/" ]; then
   RUNPID=`cat /var/run/`
   if ps -p $RUNPID; then
      echo "Mirror is already running..."
      echo "Mirror is already running..." >> /var/log/rsynccentos.log
      exit 1
      echo "Mirror pid found but process dead, cleaning up"
      rm -f /var/run/
      echo "Mirror pid found but process dead, cleaning up" >> /var/log/rsynccentos.log

   echo "No process Detected"
   echo "No process Detected" >> /var/log/rsynccentos.log


echo $$ > /var/run/

echo -n "Rsync Started at "
echo "Rsync Started " >> /var/log/rsynccentos.log

        if [ -d $DIR ]
         echo "Directory exists."
         echo "Directory does not exist, and will be created."
         mkdir -p $DIR
        $RSYNC $REMOTE $DIR > $OUTFILE 2>&1

echo "`date`" > /var/www/html/mirror/centos-last-updated.log
chown -R apache:apache $LOCAL

Any comments are greatly appreciated

Installing Kolab Groupware Solution + Horde

My team has been assigned with the task to identify suitable email/collaboration suite to be proposed to our customers. We need some basic features such as email (with imap & pop support) calendaring, to do list and mail/groupware clients connection capabilities such as Kontact, Evolution and optionally MS Outlook.

For a start we decided to tryout Kolab Groupware Solution as some their features are suitable for our client’s environment such as using OpenPkg as the installation medium (our clients could use any type of distro), the usage of Postfix, OpenLDAP and Cyrus IMAP as the back end and last but not least the solution utilize Horde as their front end interface.

Below is the simplified installation guide for installing the solution. We are using a fresh installed Centos 5 machine with minimum package installation.

– Make sure SELinux is disabled (use setup)

– Install GCC for compilation process
yum install gcc

– Install GCC (compatibility 3.4) for to resolve gcc conflict
yum install compat-gcc-34

– Making GCC-34 as default gcc tool
mv /usr/bin/gcc /usr/bin/gcc41
ln -sf /usr/bin/gcc34 /usr/bin/gcc

– Create kolab template directory
mkdir /kolab-template
cd /kolab-template

– Download kolab sources
wget -r -l1 -nd --no-parent

– Verify file integrity (optional)
gpg --verify MD5SUMS
md5sum -c MD5SUMS

[Checkpoint #1]

– Create kolab production directory
cp -afv /kolab-template /kolab
cd /kolab

– Make sure that the following names are not in /etc/passwd or /etc/groups,
“kolab” “kolab-r” “kolab-n” if exist delete and run “pwconv”

– Start compilation.
sh obmtool kolab 2>&1 | tee kolab-build.log

*This process takes some time, so it is advisable to use ‘screen’ if your are connected remotely.

– If compilation failed, simply delete/rename the /kolab folder
and restart process at [Checkpoint #1]

– Start installation
/kolab/etc/kolab/kolab_bootstrap -b

– Start the services
/kolab/bin/openpkg rc all start

– Try access (using your web browser)

– Stop kolab services
/kolab/bin/openpkg rc all stop

– Download modified kolab sources (for horde support)
mv obmtool.conf obmtool.conf.bak
wget -r -l1 -nd --no-parent

– Some hacking to the obmtool.conf due to links provided already dead
– Change
– to

– Start re-compilation
sh obmtool kolab 2>&1 | tee kolab-build.log

– Start re-installation
/kolab/etc/kolab/kolab_bootstrap -b

– Re-start the kolab services
/kolab/bin/openpkg rc all start

– Try access (using your web browser)


Continue reading “Installing Kolab Groupware Solution + Horde”