Tuesday, 18 November 2008

Use EL4 rpm in EL5 by using yum

Server

Initial setup

  • Install regular RHEL5
  • Install mrepo and createrepo packages for “el5”
  • If you do have access to a RHEL4 system:
    • Copy the contents from rhel4_system:/usr/share/rhn to rhel5_system:/usr/share/mrepo/rhn
  • If you do not have access to a RHEL4 system:
    • Fetch the up2date RPM package from CD 2 in the RHEL4 set
      • rhel4_system# mount -oloop RHEL4-U4-i386-ES-disc2.iso /mnt
      • rhel4_system# scp /mnt/RedHat/RPMS/up2date-4.4*rpm rhel5_system:/tmp
      • rhel5_system# rpm2cpio up2date-4.4*rpm | cpio -ivmud
      • rhel5_system# mkdir -p /usr/share/mrepo/rhn ; cp -r ./usr/share/rhn/* /usr/share/mrepo/rhn/
    • Alternatively, use the tarfile mentioned on the RPM-tools mailing list
  • You need to change the paths in /usr/bin/rhnget to point to the RHEL4 up2date. This can be done easily with the following command:
    sed -i s,/usr/share/rhn/,/usr/share/mrepo/rhn/,g /usr/bin/rhnget

Configuration

Create the file /etc/mrepo.conf.d/rhel5-server.conf and configure a repository for RHEL5 i386 and x86_64:

[rhel5-server]
name = Red Hat Server $release ($arch)
release = 5
arch = i386 x86_64
metadata = repomd yum repoview

### ISO images
iso = rhel-$release-server-$arch-disc?.iso

### Additional repositories
### Your mileage may vary, depending on your entitlements
### If you try any other channel than updates, you might also need to make sure you have the proper entitlements on RHN
updates = rhns:///rhel-$arch-server-$release
#fastrack = rhns:///rhel-$arch-server-fastrack-$release
#supplementary = rhns:///rhel-$arch-server-supplementary-$release
#virtualization = rhns:///rhel-$arch-server-vt-$release
#rhn-tools = rhns:///rhn-tools-rhel-$arch-server-$release

[Server] name= Server baseurl=http://192.168.100.209/dump/file enabled=1 gpgcheck=0

Usage

  • You need a systemid file to get access to RHN. You have three possibilities:
    • Enter your RHN username and password when running mrepo for the first time
    • or fetch a systemid file from a running server with has a RHN entitlement for the proper version and architecture and put it in /var/mrepo/rhel5-server-$arch/systemid
    • or use /usr/bin/gensystemid to create an entitlement and systemid file
  • Populate your repository with the command mrepo -uvvv (u is for update, vvv is for extra verbosity)
  • If you want to save some time downloading from RHN, and already have the ISOs for RHEL5, you can copy the contents of the CD /RedHat/RPMS/*.rpm to the /var/mrepo/rhel5-server-$arch/updates folder before running mrepo
  • When your repository has been populated, use mrepo -gvvv to generate the yum repository structure at /var/www/mrepo

Troubleshooting

CentOS 5

If you get an error like: rhnget: “Unknown error that needs more debugging occured with channel rhel-i386-server-5. Skipping.\n'up2date'”

Make sure /etc/sysconfig/rhn/sources is not empty and has an “up2date default” line as a minimum.

# CentOS NOTE: This file is deprecated and no longer used, all system management
# is now handled via yum, look at yum's configs to manage repositories etc
#
#

up2date default

# EOF

SElinux

You might have an issue with the web server not being able to show you the files in the yum repository. This is not due to a missing FollowSymlinks in your Apache config, but due to SElinux enforcements. Verify this with a peek at your Apache error log at /var/log/httpd/error.log. If it's trying to tell you that the symlinks doesn't exist, then try this:

chcon -Rh --reference /var/www/html /var/www/mrepo

This has been documented in /usr/share/doc/mrepo*/docs/selinux.txt.

RHEL 5.1

You may have the CentOS5 issue reported above, and may need to generate the up2date-uuid file.

  • Find unique uuid of your system:
        # uuidgen
    XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX

The file /etc/sysconfig/rhn/up2date-uuid should read:

uuid[comment]=Universally Unique ID for this server
rhnuuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Client

Configuration

  • Modify /etc/yum/pluginconf.d/rhnplugin.conf and change enabled=1 to enabled=0.
  • Create the file /etc/yum.repos.d/mrepo.conf and configure RHEL to update through your new yum repository:
    [rhel-debuginfo]
    name=Red Hat Enterprise Linux $releasever - $basearch - Debug
    baseurl=http:///mrepo/rhel-$basearch-server-$releasever
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-KEY-redhat-release

Usage

Yum update, yum install and other yum commands should work as you should be used to now.

No comments: