Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up private yum repo with basic auth

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...

like image 209
El Moreno Avatar asked Mar 28 '13 15:03

El Moreno


People also ask

How do I enable repository with yum-Config-Manager?

To enable all repositories run "yum-config-manager --enable \*". --disable Disable the specified repos (automatically saves). To disable all repositories run "yum-config-manager --disable \*". --add-repo=ADDREPO Add (and enable) the repo from the specified file or url.

What is Createrepo command in Linux?

createrepo is a program that creates a repomd (xml-based rpm metadata) repository from a set of rpms.

How enable and disable repository in yum?

To disable a particular repository or repositories, run the following command as the root user: yum-config-manager --disable repository… Alternatively, you can use a global regular expression to disable all matching Yum repositories: yum-config-manager --disable glob_expression…


1 Answers

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).

like image 196
jhutar Avatar answered Sep 29 '22 11:09

jhutar