Create own package repository in CentOS or RHEL

If you learned package management in my last post, yum requires an internet connection to each and every host to update the package which can consume lots of bandwidth. If you have a limited amount of bandwidth, then you can create your own repository server to update other machines.

Creating repository requires some steps which follows –

  • Copy all the packages from CD/DVD to machine
  • Install createrepo┬ápackage
  • Create metadata and database using createrepo command
  • Create a .repo file in /etc/yum.repos.d
  • Give priorities using yum-plugin-priorities plugin

First, create a directory at your desired location my be in /.

mount CD/DVD to /mnt or already mount then its fine, you can mount point using df -h command. Copy all the packages to /localrepo directory

install createrepo package

create metadata using createrepo command

create a .repo file in /etc/yum.repos.d. Ensure that your file extension is .repo

Now you can update/install packages by the local repository

If you want to give priority to available repositories or to your repository, then install yum-plugin-priorities plugin first

edit the .repo file created recently and add a line


Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">