Maintaining a local yum repository

Mike mike.cloaked at gmail.com
Sun Jan 27 16:38:02 UTC 2008


macgyver <macgyver <at> calibre-solutions.co.uk> writes:

> are clearing it out - so might be worth updating one machine first, then
> running the following on the other two "client" machines 
> 
> rsync -av <firsthost>:/var/cache/yum/ /var/cache/yum/
> 

I have been using the following script from my main machine that I do 
main yum updates from, to push the update rpms to the other machines:

#!/bin/bash
#
# rsync yum update packages to other machines
#
#Mike 13th July 06
#

if [ -z "$1" ]; then
        DEST_MACHINE=othermachine
# default client defined above
else
        DEST_MACHINE=$1
fi

list="fedora updates updates-testing livna"

for i in $list
do
echo Copying $i packages to $DEST_MACHINE...
rsync -av -e ssh /var/cache/yum/$i/packages/*
$DEST_MACHINE:/var/cache/yum/$i/packages/

echo Copying $i headers to $DEST_MACHINE...
rsync -av -e ssh /var/cache/yum/$i/headers/*
$DEST_MACHINE:/var/cache/yum/$i/headers/
rsync -av -e ssh /var/cache/yum/$i/headers/*
$DEST_MACHINE:/var/cache/yum/$i/headers/
done

echo Done
  exit 0

This can easily be modified for your situation...
Note that the rsync lines run over two lines above - make them into single
lines. Hope this helps.

The way I use this script is to run it from the machine where I first run
updates, and then push the rpms to the other machines - the meta data are
not copied but could easily be added to the script. Then just do a yum update
on the machine which has the new rpms. It is easy to do the main update in
a cron job and then run this script in another cron job a while later.
Other machines can then run their yum updates in later cron jobs if you want
to automate the process.




More information about the fedora-list mailing list