mrepo configuration
Here are step-by-step instructions for setting up mrepo. In this example, base, updates, and rpmforge yum repositories are created and mirrored for RHEL 2.1AS, 2.1ES, 3AS, 3WS, 4AS, and 5Server.
For this example, the mrepo directory is /mrepo.
Note: As of this writing, the current release of mrepo (0.8.4) does not support RHEL 5. For RHEL 5 support, you must retrieve and build the mrepo subversion release.
The following assumes %_topdir /home/hutch/rpmbuild is in /home/hutch/.rpmmacros, and the RPM buildroot directories /home/hutch/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} exist.
$ svn co http://svn.rpmforge.net/svn/trunk/tools/mrepo/ mrepo-0.8.4svn/
$ tar jcvf /home/hutch/rpmbuild/SOURCES/mrepo-0.8.4svn.tar.bz2 mrepo-0.8.4svn/
$ cd mrepo-0.8.4svn/
$ rpmbuild -ba mrepo.spec
# rpm -Uvh /home/hutch/rpmbuild/RPMS/noarch/mrepo-0.8.4svn-1.noarch.rpm
1. Create the /mrepo directory.
# mkdir /mrepo
2. Create subdirectories for each RHEL version.
# cd /mrepo
# mkdir 2.1AS-i386 2.1ES-i386 3AS-i386 3WS-i386 4AS-i386 5Server-i386
3. Create the systemid file for each RHN subscription.
# gensystemid -u RHN_user -p RHN_password --release=2.1AS --arch=i386 /mrepo/2.1AS-i386/
# gensystemid -u RHN_user -p RHN_password --release=2.1ES --arch=i386 /mrepo/2.1ES-i386/
# gensystemid -u RHN_user -p RHN_password --release=3AS --arch=i386 /mrepo/3AS-i386/
# gensystemid -u RHN_user -p RHN_password --release=3WS --arch=i386 /mrepo/3WS-i386/
# gensystemid -u RHN_user -p RHN_password --release=4AS --arch=i386 /mrepo/4AS-i386/
# gensystemid -u RHN_user -p RHN_password --release=5Server --arch=i386 /mrepo/5Server-i386/
4. Copy the RHEL ISOs into /mrepo/iso.
# cp *.iso /mrepo/iso
# ls -1 /mrepo/iso
RHEL2.1AS-U6-re1207.RC.0-i386-disc1.iso
RHEL2.1AS-U6-re1207.RC.0-i386-disc2.iso
RHEL2.1AS-U6-re1207.RC.0-i386-disc3.iso
RHEL2.1ES-U6-re1207.RC.0-i386-disc1.iso
RHEL2.1ES-U6-re1207.RC.0-i386-disc2.iso
RHEL2.1ES-U6-re1207.RC.0-i386-disc3.iso
RHEL4-U4-i386-AS-disc1.iso
RHEL4-U4-i386-AS-disc2.iso
RHEL4-U4-i386-AS-disc3.iso
RHEL4-U4-i386-AS-disc4.iso
RHEL4-U4-i386-AS-disc5.iso
rhel-3-u8-i386-as-disc1.iso
rhel-3-u8-i386-as-disc2.iso
rhel-3-u8-i386-as-disc3.iso
rhel-3-u8-i386-as-disc4.iso
rhel-3-u8-i386-ws-disc1.iso
rhel-3-u8-i386-ws-disc2.iso
rhel-3-u8-i386-ws-disc3.iso
rhel-3-u8-i386-ws-disc4.iso
rhel-5-server-i386-disc1.iso
rhel-5-server-i386-disc2.iso
rhel-5-server-i386-disc3.iso
rhel-5-server-i386-disc4.iso
rhel-5-server-i386-disc5.iso
5. Modify /etc/mrepo.conf appropriately. The following is an example configuration file.
[main]
srcdir = /mrepo
wwwdir = /mrepo/www
confdir = /etc/mrepo.conf.d
arch = i386
hardlink = yes
shareiso = yes
hardlinkpluscmd = /usr/bin/hardlink++ 2>/dev/null
mailto = bhutch@gmail.com
smtp-server = localhost
[5Server]
name = Red Hat Enterprise Linux $release Server ($arch)
release = 5
arch = i386
iso = rhel-$release-server-$arch-disc?.iso
metadata = repomd
updates = rhns:///rhel-$arch-server-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
[4AS]
name = Red Hat Enterprise Linux AS $release Update 4 ($arch)
release = 4
arch = i386
iso = RHEL$release-U4-$arch-AS-disc?.iso
metadata = yum repomd
updates = rhns:///rhel-$arch-as-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
[3AS]
name = Red Hat Enterprise Linux AS $release Update 8 ($arch)
release = 3
arch = i386
iso = rhel-$release-u8-$arch-as-disc?.iso
metadata = yum
updates = rhns:///rhel-$arch-as-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
[3WS]
name = Red Hat Enterprise Linux WS $release Update 8 ($arch)
release = 3
arch = i386
iso = rhel-$release-u8-$arch-ws-disc?.iso
metadata = yum
updates = rhns:///rhel-$arch-ws-$release
rpmforge = file:///mrepo/3AS-$arch/rpmforge
[2.1AS]
name = Red Hat Enterprise Linux AS $release Update 6 ($arch)
release = 2.1
arch = i386
iso = RHEL${release}AS-U6-re1207.RC.0-$arch-disc?.iso
metadata = yum
updates = rhns:///redhat-advanced-server-$arch
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
[2.1ES]
name = Red Hat Enterprise Linux ES $release Update 6 ($arch)
release = 2.1
arch = i386
iso = RHEL${release}ES-U6-re1207.RC.0-$arch-disc?.iso
metadata = yum
updates = rhns:///redhat-ent-linux-$arch-es-$release
rpmforge = file:///mrepo/2.1AS-$arch/rpmforge
6. Modify /etc/httpd/conf.d/mrepo.conf to reflect the wwwdir of /mrepo/www instead of the default /var/www/mrepo.
# sed --in-place 's!/var/www/mrepo!/mrepo/www!' /etc/httpd/conf.d/mrepo.conf
7. Loopback-mount the ISOs, and update and generate the yum repositories.
# mrepo -ugvv
Adding/Removing Distributions
In this example, I update the RHEL 3 AS and WS ISOs from Update 8 to Update 9. Note that there is little reason to continually update the ISOs,
as a fully-updated system against Red Hat Network channel(s)
should be the same regardless of which Update release is used.
1. Copy the RHEL 3 Update 9 ISOs to /mrepo/iso
# cp rhel-3-u9-i386-as-disc?.iso /mrepo/iso
# cp rhel-3-u9-i386-ws-disc?.iso /mrepo/iso
2. Modify /etc/mrepo.conf
Change:
[3AS]
name = Red Hat Enterprise Linux AS $release Update 8 ($arch)
release = 3
arch = i386
iso = rhel-$release-u8-$arch-as-disc?.iso
metadata = yum
updates = rhns:///rhel-$arch-as-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
[3WS]
name = Red Hat Enterprise Linux WS $release Update 8 ($arch)
release = 3
arch = i386
iso = rhel-$release-u8-$arch-ws-disc?.iso
metadata = yum
updates = rhns:///rhel-$arch-ws-$release
rpmforge = file:///mrepo/3AS-$arch/rpmforge
To:
[3AS]
name = Red Hat Enterprise Linux AS $release Update 9 ($arch)
release = 3
arch = i386
iso = rhel-$release-u9-$arch-as-disc?.iso
metadata = yum
updates = rhns:///rhel-$arch-as-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
[3WS]
name = Red Hat Enterprise Linux WS $release Update 9 ($arch)
release = 3
arch = i386
iso = rhel-$release-u9-$arch-ws-disc?.iso
metadata = yum
updates = rhns:///rhel-$arch-ws-$release
rpmforge = file:///mrepo/3AS-$arch/rpmforge
3. Unmount the ISOs
# mrepo --unmount
4. Remove the old ISOs
# rm /mrepo/iso/rhel-3-u8-*.iso
5. Remount the ISOs
# mrepo --remount
6. Regenerate mrepo repositories for the updated distributions.
# mrepo -gvv 3AS-i386 3WS-i386
"Freezing" a Repository
When building systems with identical functionality (e.g., Web servers)
at different points in time, it's likely that system packages in
dynamic repositories such as updates and rpmforge
have been updated. Quality Assurance (QA) teams will likely frown upon
this, and will be quick to blame any system instability at slight
system package differences (e.g., httpd-2.2.3-10.el5 on one system, httpd-2.2.3-11 on another system).
In this example, I create a RHEL 5 repository called frozen which is a point-in-time snapshot of updates and rpmforge.
$ cd /mrepo/5Server-i386
# mkdir frozen
# for RPM in $(find rpmforge/ updates/ -iname *.rpm) ; do ln $RPM frozen/${RPM##*/} ; done
I then make the following change in bold to mrepo.conf:
[5Server]
name = Red Hat Enterprise Linux $release Server ($arch)
release = 5
arch = i386
iso = rhel-$release-server-$arch-disc?.iso
metadata = repomd
updates = rhns:///rhel-$arch-server-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
frozen = file:///mrepo/5Server-$arch/frozen
and generate the yum repositories:
# mrepo -gvv 5Server-i386
The systems using the frozen repository should then have their yum.conf modified so that all repositories except base and frozen are disabled (enabled=0).
To update the frozen
repository, remove all files from the directory (unless there is a need
to preserve the old files), re-populate the directory, and
generate the yum repositories.
Example:
# cd /mrepo/5Server-i386
# rm frozen/*
# for RPM in $(find rpmforge/ updates/ -iname *.rpm) ; do ln $RPM frozen/${RPM##*/} ; done
# mrepo -gvv 5Server-i386
Error running gensystemid
When attempting to entitle my mrepo
server for an additional channel--in this case, Red Hat Enterprise
Linux (v. 5 for 64-bit x86)--I received the following error message:
# gensystemid -u RHN_user -p RHN_password --release=5Server --arch=x86_64 /mrepo/5Server-x86_64/
Traceback (most recent call last):
File "/usr/bin/gensystemid", line 270, in ?
main()
File "/usr/bin/gensystemid", line 243, in main
systemid = rpcServer.doCall(s.registration.new_system, auth)
File "/usr/share/rhn/up2date_client/rpcServer.py", line 309, in doCall
raise up2dateErrors.CommunicationError(e.errmsg)
up2date_client.up2dateErrors.CommunicationError: Error communicating with server. The message was:
Internal Server Error
This error occurs when the number of registered systems is equal to the
number of entitlements available, even if not all of the registered
systems are entitled.
In this example, I have 6 "Update" entitlements. 6 systems are registered with RHN, but only 5 of them are entitled; i.e., https://rhn.redhat.com/rhn/systems/SystemEntitlements.do shows that I have 1 available entitlement.
To unregister a system, select a registered system, select Alter Channel Subscriptions, and either select delete system or change Base Channel: to None - disable this service. I can then run gensystemid successfully.
Adding an architecture
In this example, mrepo is already configured for RHEL 5 Server i386, and we add the x86_64 DVD ISO and x86_64 repositories.
/etc/mrepo.conf changes in bold:
[5Server]
name = Red Hat Enterprise Linux $release Server ($arch)
release = 5
arch = i386 x86_64
iso = rhel-$release-server-$arch-disc?.iso rhel-5.1-server-$arch-dvd.iso
metadata = repomd
updates = rhns:///rhel-$arch-server-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
Generate the yum repositories:
# mrepo -gvv 5Server-i386
Miscellaneous Notes
DVD ISOs are supported. Beginning with RHEL 5.1 (5 Update 1), the Red
Hat individual CD ISOs or one DVD ISO. The following works:
# ls -l /arch/mrepo/iso/rhel-5.1-server-i386-dvd.iso
-rw-r--r-- 1 root root 2988226560 Dec 5 11:05 /arch/mrepo/iso/rhel-5.1-server-i386-dvd.iso
Applicable /etc/mrepo.conf entry:
[5Server]
name = Red Hat Enterprise Linux $release Server ($arch)
release = 5
arch = i386
iso = rhel-5.1-server-$arch-dvd.iso
metadata = repomd
updates = rhns:///rhel-$arch-server-$release
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el$release/en/$arch/RPMS.dag/
Back to brandonhutchinson.com.
Last modified: 2008/07/17