19

With one repository I did it like this (as root):

# cd /etc/yum.repos
# wget https://some.repo.example.org/foo/bar/Fedora_14/foo_bar.repo
# grep enabled foo_bar.repo
enabled=1

Is this the recommended way to add a package repository under Fedora (>= 14)?

Is there some policy/standard which specifies that each proper Fedora package repository should (or must) contain such a config file (i.e. such a .repo file)?

(basically just for the reason that a user or some tool can copy it to the local /etc/yum.repos directory?)

maxschlepzig
  • 57,532
  • 1
    @Tshepang: I don't understand. Have you mixed up question mark and full stop in your comment? And what typo are you referring to? Just point out the typo or edit my question and fix it since you have already spotted it. I fix the last question - but I don't know if this is the typo you mean ... – maxschlepzig Feb 04 '11 at 00:12
  • 2
    I made those prompts # because you said you ran the commands as root. That's the convention, and that's what root prompt looks like. – tshepang Feb 04 '11 at 08:43
  • @Tshepang, fair enough - changed the prompt to the common # convention. – maxschlepzig Dec 17 '11 at 18:27

6 Answers6

8

The Fedora 14 docs. haven't been updated yet. The latest way to do this with just a .repo file is:

yum-config-manager --add-repo=https://some.repo.example.org/foo/bar/Fedora_14/foo_bar.repo

...you can then use yum-config-mananger --enable etc. too.

Kevin
  • 40,767
James Antill
  • 1,973
7

If you are using Fedora 22 or later, where dnf has replaced yum as the default package manager, then you can use this command taken from here:

dnf config-manager --add-repo repository_url

where repository_url is a link to the .repo file.

And you can enable it by:

dnf config-manager --set-enabled repository

where repository is the unique repository ID.

6

I googled a bit around with 'fedora add repository' and got some outdated and not very helpful links. Because of the noise I missed this link:

http://docs.fedoraproject.org/en-US/Fedora_Core/3/html/Software_Management_Guide/sn-using-repositories.html

Which is kind of outdated as well, but it gives me the hint to look for an updated version of the software management guide:

Add New Repositories

(which also mentions the wget method I used to add a .repo file)

I am a bit surprised that the official and as it seems quite extensive fedora documentation is not higher scored in the google results.

maxschlepzig
  • 57,532
  • The first link is to the Fedora Core 3 documentation, which is 5-6 years out of date. – James Antill Feb 16 '11 at 14:54
  • @James Antill: Yeah - kind of outdated was used as an euphemism. ;) Anyways, when I googled the query, the 5-6 year old fedora link is what I got on the first result page (position > 20). Don't know if the fedora project pages do some stuff to annoy the google bot? – maxschlepzig Feb 16 '11 at 16:03
2

It appears that in recent versions of Fedora, there was an attempt to integrate a "Media Repo" with PackageKit, but there were enough bugs that it was left out of Fedora 14 (this for example). It sounds like you're going to have to follow the directions mentioned in the other answers to either copy the packages locally or mount the ISO image as a loopback device, and set up yum file:// URLs to point a the packages.

jsbillings
  • 24,406
1

Adding a repository is quite easy in red hat or in any other redhat based system's. Its a matter of a repo file, which will specify the url from where to fetch the rpm files to install.

However if you want to understand the complete working of yum. I will recommend reading the below link.

YUM repository configuration

sarath
  • 11
1

See here: Howto: Add a new yum repository to install software under CentOS / Redhat Linux

yasouser
  • 416