RHEL – How to Create Local Repositories

repositoryrhelyum

I need to create a local repository in RHEl 5.5. i386

Because when I type some command in terminal it say that RHEL is not subscribed with RHN which is true. I took it from friend.

So can someone tell me how to achieve this target.

Further Actions based on Warl0ck instructions.

  • I copied the RPM's from Mdia to /home/Umair/RPM folder
  • I installed the script createrepo-0.4.11-i386.el5.noarch.rpm located
    in Server directory of Installation Media.
    Then it took some time to generate metadata. Total Packages 2348

Metadata

  • Then I create the local repo file using vi

vi /etc/yum.repos.d/local.repo

These are the entries I added.

Repo text

And finally i run this command

yum -y install apache php{,-cgi,-cli,-gd,-mysql} mysql{,-server}

and in reply bash slapped me with error

erro

Best Answer

There're plenty of documents out there, given a set of RPM packages, you could do something like this,

First install the createrepo script, by

rpm -ivh /path/to/mounted/cdrom/createrepo*.rpm (Depends where you mounted your RedHat DVD)

Now create a folder to hold all RPMS that you want to be in the repository, e.g RPMS, and put the needed "*.rpm" files inside,

Then do createrepo /path/to/RPMS to generate metadata.

When finished, add the repository to your yum config, e.g put the following to /etc/yum.repos.d/local.repo

[local]
name=Local Repository Demo
baseurl=file:///absolute/path/to/RPMS
enabled=1
gpgcheck=0
protect=1
Related Question