Set up private yum repo with basic auth

El Moreno picture El Moreno · Mar 28, 2013 · Viewed 10.9k times · Source

I have set my own private yum repo. This is an HTTP base repo with a Apache as a web server, so I would like to add some kind of authentication. Is this something I need to do with Apache or is there anything I can do with the createrepo library to specify a user-name and password? The final goal is to have several repos:

Dev-Repo, QA-Repo, Staging-Repo, and Production-Repo

I want developers to have access to only the dev-repo, have QA access only QA-Repo and so on...

Answer

jhutar picture jhutar · Nov 10, 2014

To setup basic auth on server side, follow http://httpd.apache.org/docs/2.2/howto/auth.html#gettingitworking (paths might differ - they surely do on mine Fedora installation).

To setup yum to consume that repo you can add either:

baseurl=http://user:[email protected]/myrepo/Dev-Repo

or:

username=user
password=pass

to repo's config /etc/yum.repos.d/myrepo-DevRepo.repo (taken from https://serverfault.com/questions/609548/yum-repo-basic-auth-not-working).