Product SiteDocumentation Site

4.4. Priority Configuration

Following with yum configuration, we will show how to configure Fedora to make yum use the repositories on priority based order without discarding the external mirrors list. Let us see the needed configuration.
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://mirepo.org/$releasever/$basearch/os/
        http://otrorepo.org/$releasever/$basearch/os/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
First note the use of multiple URLs in baseurl. It should be done as set here, and do not use multiple baseurl statements cause it will not work properly.
Then note the use of the failovermethod statement, this parameter can have values 'roundrobin' or 'priority'. The default value is 'roundrobin' that randomly selects a URL from the list of URLs. When the value is 'priority' it means to start from the first URL from the list of URLs. It is important to note here that the list of URLs is constructed from the baseurl statement and then from the list obtained from mirrorlist. In that way the desired goal is achieved, searching in the local repositories first, and then, if they fail, in the specified order, searching in the URLs from the mirrors list.