SDB:Setting up a local repository server for OpenSuSE 10.3
From openSUSE
--Darragh Ó Héiligh 13:10, 17 December 2007 (UTC)
Contents |
Situation
You have a small network and you would like to save bandwidth and increase update speeds by providing a local update server. You already have a machine with OpenSuSE 10.2 or 10.3 set up for this purpose.
Procedure
In a nutshell, all we really need to do to set up a local update server is mirror a remote repository, set up a cron job to ensure this mirror is kept up to date and then create a NFS share to make the repository available to everyone on your network.
Mirroring a repository.
To mirror a repository, use a command such as rsync. This provides configuration options to exclude certain files and only download files not already in the repository directory.
To configure the rsync command to download the updates for you, you could write a one line command and add it to crontab however that does not allow easy modification. Therefore, it is advisable to use the below script as you can alter it to provide enhanced logging, more administration on the files that have been downloaded etc.
Using your favorite editor, create a file in /root/bin/auto-update and set it’s permissions to read, write and execute for owner users and groups using the command
chmod 777 /root/bin/auto-download
Include the following text in the file you have just created.
#!/bin/sh
YOU_DIR=/srv/nfs/updates
UPDATEPATH=opensuse/update/10.3
DESTINATIONPATH=$YOU_DIR"/"$UPDATEPATH
SOURCEPATH=ftp5.gwdg.de::pub/linux/suse/opensuse/update/10.3/.
test -d $DESTINATIONPATH || mkdir -p $DESTINATIONPATH
echo -e "Syncing patches from $SOURCEPATH \n"
rsync -rltuzv --stats --progress --delete --delete-excluded \
--exclude "ppc/" \
--exclude "ppc64/" \
--exclude "x86_64/" \
$SOURCEPATH $DESTINATIONPATH
logger -t patch-download-cronjob[$$] Updating of SuSE 10.3 from $SOURCEPATH finished.
exit 0
Be sure to have port 837 open for rsync on your firewall.
Configuring cron
Now, add the cron job using the following command. This will instruct the system to check for updates at 4AM every day.
Crontab -a 0 4 * * * $HOME/bin/auto-update
Configure the NFS share
Now, edit the file /etc/exports again using the editor of your choice. Include the following line:
/srv/nfs/Updates *(ro,root_squash,sync)
The system must be instructed to recognise the changes made to this exports file. therefore we must run two editional commands.
exportfs exportfs -ra
This will make this directory available on your network for all to use as we are not editing the /etc/hosts.allow or /etc/hosts.deny files. Ordinarily, this would not be a good idea as the system you will now have is accessible by anyone on your network however for the purpose of this guide it fulfills our needs.
Configure Yast to use this repository
When you have the update source created, you will need to mount it on the client PC’s. This can be done automatically by putting an entry into your /etc/fstab file however to have it activate straight away, type the command:
mount 10.219.1.10:/srv/updates/opensuse/update/10.3 /mnt/
Where 10.219.1.10 is the IP of your server.
Finally, add this installation source into your repositories list in Yast by clicking on the software module, then choose installation source, click add to choose the type of repository, select local directory and click next. Now type the path name /mnt/ and click next to save your changes.
To ensure this new repository is used by yast, you will need to delete the existing online update sources. This may be done in the repositories section also.
As with all repositories, you will need to configure it via the “Configure repository option within the Software module in Yast. Simply click the next button to instruct Yast to examine this new source.
Now that you have set up and configured the repository on the server and client machines you can use the online update option to download updates.
sources
If you require further assistance with configuring an nfs server, follow the helpful instructions on the following page: http://nfs.sourceforge.net/nfs-howto/ar01s03.html

