Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

How to combine a network install directory / yum repository

by Remco Veldkamp on Sep 02, 2004 (UPDATED 2004-10-07)

Introduction

This document describes how to setup a directory structure consisting of the base Fedora Core rpm's and some extra files that are found on the Fedora iso's, in such a way that the resulting 'repository' can be accessed both using the yum command (or up2date for that matter) and the Fedora installer (Anaconda) to perform a network installation.

update: there's a great tool called yam, written by Dag Wieers, that automates this procedure and more!
(from the website: "Yam builds a local APT/Yum RPM repository from local ISO files, downloaded updates, and extra packages from 3rd party repositories. It takes care of setting up the ISO files, downloading the RPMs, configuring HTTP access and providing PXE/TFTP resources for remote network installations.")

Requirements

  • Fedora Core iso's (see links section)
  • approx. 2 GB of additional diskspace for the repository
  • yum should be installed
  • a http, ftp or nfs server (whatever you prefer) note: configuring a http, ftp or nfs server is not described in this document; the examples provided assume you're using a default Apache configuration.
  • you will need root priviliges

Setting up the repository

  1. Create directories to (temporarily) mount the iso's on
    mkdir /mnt/tmp1 /mnt/tmp2 /mnt/tmp3
    
  2. mount the iso's
    In this example the iso files are assumed to be in the current directory. If they aren't you will need to use the correct path.
    mount -o loop yarrow-i386-disc1.iso /mnt/tmp1
    mount -o loop yarrow-i386-disc2.iso /mnt/tmp2
    mount -o loop yarrow-i386-disc3.iso /mnt/tmp3
    
  3. Create a directory
    Create a directory where the contents of the iso's will be copied to. This is probably both the easiest and most important step. Choose the location of the repository carefully. It has to be accessible by whatever server (http,ftp or nfs) you use. In this example, a subdirectory 'fc1' is created in '/var/www/html', which is Apache's default DocumentRoot:
    mkdir -p /var/www/html/fc1
    
  4. Copy the contents of the iso's
    cp -r /mnt/tmp1/Fedora /var/www/html/fc1
    cp -r /mnt/tmp2/Fedora /var/www/html/fc1
    cp -r /mnt/tmp3/Fedora /var/www/html/fc1
    cp /mnt/tmp1/RELEASE-NOTES* /var/www/html/fc1
    
  5. Optional: Dos utilities and disk images
    This step is neither needed to perform a network install nor for yum usage but these files will make your repository all the more complete ;-)
    NOTE: the dosutils are not included in Fedora Core 2.
    cp -r /mnt/tmp1/dosutils /var/www/html/fc1
    cp -r /mnt/tmp1/images /var/www/html/fc1
    
  6. Make the repository world-readable
    find /var/www/html/fc1 -type d -exec chmod o=rx {} \;
    find /var/www/html/fc1 -type f -exec chmod o=r {} \;
    
  7. Adding support for yum
    To set up a yum repository, extract the rpm headers for use with yum.
    yum-arch -dvvz /var/www/html/fc1/Fedora/RPMS
    
  8. Cleaning up
    To clean up, unmount the iso's and remove the directories they where mounted on.
    umount /mnt/tmp1
    umount /mnt/tmp2
    umount /mnt/tmp3
    rmdir /mnt/tmp1
    rmdir /mnt/tmp2
    rmdir /mnt/tmp3
    

Starting the HTTP/FTP/NFS server

You might still need to configure your HTTP/FTP/NFS server, which I won't describe here. If you're using a default Apache configuration you can start it with:

service httpd start

Then make sure Apache starts automatically after a reboot:

chkconfig httpd on

Check if the repository is accessible

The easiest way to check if the repository is accessible is to open up a browser and enter the URL of you repository. Just remember that in the URL the location of the repository is relative to the DocumentRoot directory of Apache (or your FTP/NFS server). Following the example above, the repository is located at:

/var/www/html/fc1

Assuming you're using a standard Apache configuration, the URL would be:

http://yourhost.yourdomain/fc1

Installing over the network

Choose the HTTP, FTP or NFS during the installation process and enter the hostname and directory of the repository:

Website name:    yourhost.yourdomain

directory:       fc1

To use yum, you first need to add your repository to /etc/yum.conf. For example:

[base]
name=Fedora Core 1 - Base
baseurl=http://myhost.mydomain/fc1
        http://fedora.redhat.com/releases/fedora-core-1  
The example still lists the offical RedHat repository, which is now used as a backup repository, meaning that if your personal repository is unavailable you will still be able to install rpm's with yum. (Just make sure the second URL starts with a tab on a new line.)

Will this work with the DVD iso's?

Yes, just ignore all references to the second and third iso's and 'tmp' dirctories

Will this work on RH7/8/9?

I believe the procedure will work for all Red Hat Linux versions that support a network install and yum but I'd like this to be confirmed.

What about apt-get?

I personally don't use apt-get, but if you know how to implement support for apt-get please let me know and I'll update this howto accordingly.

Links

Feedback

If you have anything to contribute/suggest or just want to point out a typo, please email me.