How do I create yum repo file?

Found this here. Hope it helps.

The 'baseurl' line is the path that machine uses to get to the repository. If the machine has direct access to it or mounts it as a filesystem you can use a baseurl line like:

 baseurl = file:///srv/my/repo/

There are 3 slashes (/) following the file:, not 2. That is correct.

If you access the file via an http or https server you would use something like:

 baseurl = http://servername/my/repo

The baseurl is the location of the repository's files. You obtain this information from the provider of the repository.

Most repositories already provide a pre-configured .repo file which you can drop into /etc/yum.repos.d or a release.rpm which you can install which contains such a .repo file (this way is better since the repo can then keep itself updated).


This is what i do

  1. I create the Folder call RPMS
  2. Then copy all the files from /Media/RHEL*/Server to /RPMS using cp * /RPMS when I'm in /Media/RHEL*/Server directory then it takes some minutes to copy all Rpms
  3. Then i create Repo for /RPMS
  4. After that i make a copy of /etc/yum.repos/rhel-source and name it rhel-local.repo
  5. Then vi rhel-local.repo and add following lines

[rhel-local.repo]

name=rhel-local

baseurl=file:///RPMS

enabled=1

gpgcheck=0

Finally run yum clean all and yum list all

BASEURL is the absolute path to files

Hope this helps