Product SiteDocumentation Site

4.8.2. Manual Configuration of a Repository

Next, we will review as an example the manual configuration of a particular .repo file to examine its details and to take control of each one of them.
/etc/yum.repos.d/fedora.repo
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$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

[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-source]
name=Fedora $releasever - Source
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
As in many Linux configuration files, lines beginning with # are comments and they are ignored by yum.
Each [nombre] section defines a yum repository, then within each repository definition you can overwrite the general behavior of yum with global scope policy for handling this particular repository or you can add new specific directives at repository scope.
[fedora]  << repository identifier
name=Fedora $releasever - $basearch
baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
The repository identifier must be unique.
name
A string (name) of characters that describes the repository for the human.
baseurl
Must be a URL that points to the directory where the yum 'repodata' is. It can be a http://, ftp:// or file:// URL. You can specify multiple URLs in a statement, the best way to do it is:
[repositoryid]
name=Some name for this repository
baseurl=url://server1/path/to/repository/
        url://server2/path/to/repository/
        url://server3/path/to/repository/
You can use HTTP basic authentication prefixing "usuario:contraseña@" to the server name in the line baseurl, for example baseurl=http://usuario@passwd@example.com/.
mirrorlist
It specifies a URL that points to a file containing a list of baseurls. You can use this statement instead of baseurl.
enabled
It can be '1 'or '0'. This tells yum to whether or not use this repository.
gpgcheck
It can be '1 'or '0'. This tells yum whether or not to perform a GPG signature verification on packages obtained from this repository.
gpgkey
A URL that points to a file containing ASCII GPG key for the repository. This option is used if yum needs a public key to verify the packages and the required key has not been imported into the RPM database. If this option is placed yum will automatically import the key specified by the URL. yum will ask for confirmation before installing the key unless you specify assumeyes. Also you can list multiple URLs in the same way as it was done for baseurl.
failovermethod
It can be 'roundrobin' or 'priority'. 'roundrobin' randomly selects a URL from the list of URLs to start and then if it failes to contact the selected server it proceed with another selected similarly. 'priority' starts from the first one listed in baseurl and if it fails to contact the server, it continues sequentially with the next in the list. If not specified, the default is 'priority'.