[Nottingham] Re: Local RPM repository

David Aldred david at familyaldred.org.uk
Fri Mar 25 19:32:53 GMT 2005


Following this thread, I've put together the following guide to setting up a 
local repository.  Comments welcome - then I can put it on my webspace or, 
better, on NLUG's webspace if that can be managed - easier for people to 
find!)

-------------------------------------------------------------------------------------------------

Creating local RPM repository for a home network
==============================

This assumes that you have a local network running behind an effective 
firewall, so that leaving an ftp port open internally is 'safe'. 

1.  EITHER set up anonymous FTP on your machine, OR decide which user/password 
is to be used locally for urpmi activties (probably better)
2.  Create a directory as a repository on your main machine.  For anonymous 
FTP purposes, this directory should be below var/ftp/pub, and needs to have 
owner and group "ftp".  If not using anonymous FTP, it can be anywhere inn 
the appropriate /home/user directory. 
3.  Place your RPMs into this directory, with the appropriate owner/group.
4.  cd to the directory
5.  Run genhdlist

6.  Ensure your ftp service is running

7.  You can now add the repository as a source on other machines, using 
        urpmi.addmedia localsource ftp://<localmachine>/<path to directory>/ 
with synthesis.hdlist.cz
    If using a username/password, change this to 
ftp://<user>:<pass>@<localmachine>.....

8.  When doing updates on your main machine, use the 'noclean' option for 
urpmi (making an alias for urpmi to urpmi --noclean will help avoid 
forgetting!)
9.  Periodically:
	copy all files from /var/cache/urpmi/rpms to your repository directory
	chown / chgrp them to the appropriate owner details
	run genhdlist
	(This can be made into a script and run as a cron job!)
	
10.  When installing anything on another machine, again use the 'noclean' 
option.   Periodically upload the rpms stored in /var/cache/urpmi/rpms on 
this machine to the repository on the main machine (again possibly a cron
Suitable script for part 9 (needs to be run as root): job).  The next time 
genhdlist is run on the main machine (probably by cron) these uploaded rpms 
will be included. 


Suitable script for part 9 (needs to be run as root):

#/bin/bash
# Variables (put your info here) 
#
REP_PATH = <full path to repository directory>
FTP_USER = <username used for ftp>
#
# Change to the repository directory
cd $REP_PATH
#
# Copy in the files from the cache, using force & update flags
mv -fu /var/cache/urpmi/rpms/*.rpm ./
#
# Change owner & group info (was root)
chown $FTP_USER *
chgrp $FTP_USER *
#
# Build the hdlist
genhdlist

------------------------------------------------------------------------------------------------

-- 
David Aldred



More information about the Nottingham mailing list