[WBEL-users] how to make a yum repository

Hedemark, Magnus mhedemark@trueposition.com
Wed, 7 Apr 2004 14:59:26 -0400


Kerry Cox [mailto:kerry.cox@ksl.com] asks:

> Kirby brings up a good point. If people are serious about maintaining
> Whitebox on their own networks, there ought to be some instructions
> regarding the creation and maintenance of a local yum 
> repository. I have
> been meaning to do this for quite some time. But, I do not want to
> reinvent the wheel. 
> Has anyone run across some simple documentation for setting up a local
> yum repository? Anyone willing to share this? If not, I'd be happy to
> create something fast in XML format and then publish in to HTML using
> DocBook. Or, if someone already has some instructions, send 
> them my way
> and I'll publish it for everyone in HTML format.

I did this for CentOS (probably redundant since CentOS main site is
yum-ified).  Easily adapted for any other RPM based distro.  You need to
have the basic yum & rsync packages installed to do this.  Enjoy.



#!/bin/bash

REPOSITORY="wopr.mind.ilstu.edu::centos-3"
DESTDIR="/var/www/yum/centos"
if [ -d $DESTDIR ]
  then
    rsync -aqzH \
      $REPOSITORY \
      $DESTDIR
    if [ -d "$DESTDIR/3.1/i386/RedHat/RPMS" ]
      then yum-arch -q $DESTDIR/3.1/i386/RedHat/RPMS
      else echo "ERROR updating yum indexes for
$DESTDIR/3.1/i386/RedHat/RPMS"
    fi
    if [ -d "$DESTDIR/3.1/addons/i386" ]
      then yum-arch -q $DESTDIR/3.1/addons/i386
      else echo "ERROR updating yum indexes for $DESTDIR/3.1/addons/i386"
    fi
    if [ -d "$DESTDIR/3.1/extras/i386" ]
      then yum-arch -q $DESTDIR/3.1/extras/i386
      else echo "ERROR updating yum indexes for $DESTDIR/3.1/extras/i386"
    fi
    if [ -d "$DESTDIR/3.1/updates/i386" ]
      then yum-arch -q $DESTDIR/3.1/updates/i386
      else echo "ERROR updating yum indexes for $DESTDIR/3.1/updates/i386"
    fi
  else echo "ERROR rsyncing CentOS to $DESTDIR"
fi