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

#!/bin/sh
# created by Jalte @ http://www.ridinglinux.org

DATE=`/bin/date +%Y-%m-%d`
OUTFILE=/var/www/html/mirror/centos-mirror.log
RSYNC="/bin/nice /usr/bin/rsync --verbose --progress --delete-excluded --stats --archive --partial --timeout=600"
MIRROR=mirrors.kernel.org::centos
VER=5
ARCHLIST="i386 x86_64"
BASELIST="os updates"
LOCAL=/var/www/html/mirror/centos

date >> /var/log/rsynccentos.log

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

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

fi

echo $$ > /var/run/rsynccentos.pid

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

for ARCH in $ARCHLIST
do
  for BASE in $BASELIST
    do
        DIR=$LOCAL/$VER/$BASE/$ARCH/
        if [ -d $DIR ]
        then
         echo "Directory exists."
        else
         echo "Directory does not exist, and will be created."
         mkdir -p $DIR
        fi
        REMOTE=$MIRROR/$VER/$BASE/$ARCH/
        $RSYNC $REMOTE $DIR > $OUTFILE 2>&1
    done
done

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 http://ftp.belnet.be/packages/kolab/server/release/kolab-server-2.1.0/sources/

– 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)
https://kolab_adress/admin

– 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 http://build.pardus.de/downloads/kolab-horde-tmp

– Some hacking to the obmtool.conf due to links provided already dead
– Change
URL="ftp://ftp.klaralvdalens-datakonsult.se/pub/kolab/server/current/2.1"
– to
URL="http://build.pardus.de/downloads/kolab-horde-tmp"

– 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)
http://kolab_address/horde

REFERENCES
http://wiki.kolab.org/index.php/Kolab2_Installation_-_Source
http://wiki.kolab.org/index.php/Fedora_6
http://wiki.kolab.org/index.php/Kolab2_Installation_-_Horde

Continue reading Installing Kolab Groupware Solution + Horde