How to Setup Local HTTP Yum Repository on CentOS 7

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

44 Responses

  1. Ardi says:

    Hi,

    I am trying following step 9..

    # createrepo -g comps.xml /var/www/html/repos/base/  
    # createrepo -g comps.xml /var/www/html/repos/centosplus/	
    # createrepo -g comps.xml /var/www/html/repos/extras/  
    # createrepo -g comps.xml /var/www/html/repos/updates/
    

    and i got massage like this..

    Cannot create/verify /var/www/html/repos/base/.repodata
    Cannot create/verify /var/www/html/repos/centosplus/.repodata
    Cannot create/verify /var/www/html/repos/extras/.repodata
    Cannot create/verify /var/www/html/repos/updates/.repodata
    

    can anyone help me?

    thanks.

    • Iñaki says:

      Use -g comps.xml only with base repo, Use that after:

      # createrepo /var/www/html/repos/centosplus/	
      # createrepo /var/www/html/repos/extras/  
      # createrepo /var/www/html/repos/updates/
      
  2. Iñaki says:

    Hi, Thanks for that post!

    I have followed all steps, but finally, my local-base repo is enabled but appears a zero in the number of packages.

    The output for "yum repolist all" is:
    id del repositorio nombre del repositorio estado
    !local-base CentOS Base habilitado: 0
    !local-centosplus CentOS CentOSPlus habilitado: 0
    !local-extras CentOS Extras habilitado: 0
    !local-updates CentOS Updates habilitado: 0
    repolist: 0

    Can anybody help me, please?

  3. Stephen Westrip says:

    Hi,

    My local repo is working fine EXCEPT when I go onto another server and run a ‘yum update‘ I get nothing because the RPM was originally installed from CentOS 7 repos and the repo name is ‘base‘.

    Now my local repo is named ‘local-base‘ the update does not work. I assume the update looks at the package name AND repo name and then if a match it would allow an update (if required). How do I bulk-update all the packages on my server so that yum thinks the RPM was installed from my ‘local-base‘ repo?

    By the way, I can install new packages from the local repo successfully.

    Thanks

    • Stephen Westrip says:

      An update to my OP – it is not the repo name as I changed the local-repos.repo file to have a repo name of base and that did not list updates either. I can install new packages, reinstall packages, list available and installed packages. Everything other than update packages!!

      I have no idea what the problem could be now. Any assistance gratefully received.

      • Stephen Westrip says:

        *SOLVED* The problem was that I had not enabled local-updates. Thanks to those who took the time to reply.

    • Ravi Saive says:

      @Stephen,

      I think you should enable your local-base repo by changing enabled to 1 option in the .repo file.

  4. jithendar says:

    Hi, how can I add the yum repository to the client server, as I am getting the “server not found” error when am trying to download the repos in the client server.

  5. Bobby says:

    Thanks for the article. Works good but how do you create a epel offline repo? I used the steps to add epel download and it works but the client errors out as the epel repo folder does not have repodata folder even though I have the switch --download-metadata.

  6. Jack Ka says:

    Hi,

    I can’t yum anything from client when i was config follow this article.

    [[email protected] ~]# yum repolist all
    Loaded plugins: fastestmirror, langpacks
    http://nginx.htp.local/base/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
    Trying other mirror.
    http://nginx.htp.local/base/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
    Trying other mirror.
    http://nginx.htp.local/centosplus/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
    Trying other mirror.
    http://nginx.htp.local/extras/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
    Trying other mirror.
    http://nginx.htp.local/updates/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
    Trying other mirror.
    repo id                                                 repo name                                                 status
    local-base                                              CentOS Base                                               enabled: 0
    local-centosplus                                        CentOS CentOSPlus                                         enabled: 0
    local-extras                                            CentOS Extras                                             enabled: 0
    local-updates                                           CentOS Updates                                            enabled: 0
    

    But when I yum update is failed:

    failure: repodata/repomd.xml from local-base: [Errno 256] No more mirrors to try.
    http://nginx.htp.local/base/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
    
  7. Ziad says:

    Hi

    I’m try to execute this command

    # createrepo -g comps.xml /var/www/html/repos/centosplus/	
    # createrepo -g comps.xml /var/www/html/repos/extras/  
    # createrepo -g comps.xml /var/www/html/repos/updates/  
    

    but it show me error like this:

    Error: groupfile /var/www/html/repos/centosplus/comps.xml cannot be found.
    Error: groupfile /var/www/html/repos/extras/comps.xml cannot be found.
    Error: groupfile /var/www/html/repos/updates/comps.xml cannot be found.
    
  8. Chris Pesoa says:

    Hi,

    How much resources should we allocate for the repo server?

    RAM/HDD/Swap, etc.

    Thanks.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.