Product SiteDocumentation Site

9.2. Repository Definition Files

Create and edit repository definition files with a text editor. Definition files are plain-text with a standard format:
      
       [serverid]
       name=Some longer name and description for this repository
       baseurl=url://path/to/repository-copy-1/
               url://path/to/repository-copy-2/
       enable=(0 to disable this file, or 1 to enable it)
       gpgcheck=(0 to disable checking signatures of packages from this repository, or 1 to enable checking)
       gpgkey=url://path/to/gpg-key-file
      

Example 1. Format of yum Repository Definition Files

The baseurl must specify the complete URL for the root directory of the repository, including the http://, https:// or ftp:// prefix. You may also specify a directory on your system, by using the prefix file:// in the baseurl.

Logging in to Protected Repositories

To use a password-protected repository, include the correct username and password in the baseurl. For example, ftp://user:password@myrepository.com/$releasever/mypackages/.
If possible, list more than one directory or server that holds a copy of the repository. This enables yum to use another repository if the first is unavailable. By default yum randomly selects repositories from the baseurl list. To force yum to use them in sequence, add the option failovermethod=priority.
It is also good practice to use variables like $releasever in the URL, rather than setting these to a specific value. The available variables are listed on the man page for yum.conf. Using variables enables the same definition to function when your system is upgraded to a later version, or if the configuration is copied to another machine.
A definition file is shown below that uses all of these features. In this example, copies of the repository are held in the directory /srv/software/Fedora;/3;/mypackages/ on the system itself, in the directory software/Fedora;/3;/mypackages/ on the Web server www.my-repository.com/, and in the directory pub/software/Fedora;/3;/mypackages/ on the FTP server server.another-repository.org. Here, yum will access the FTP server with the username yum-user and the password qwerty. The failovermethod ensures that yum will check the copy on the local machine, before trying the servers in sequence.
      
       [MyPackages]
       name=Some packages for Fedora $releasever
       baseurl=file:///srv/software/fedora/$releasever/mypackages/
               http://www.my-repository.com/software/fedora/$releasever/mypackages/
               ftp://yum-user:qwerty@anotherserver.another-repository.org/pub/software/fedora/$releasever/mypackages/
       failovermethod=priority
       enable=1
       gpgcheck=1
       gpgkey=http://www.my-repository.com/software/fedora/keys/RPM-GPG-KEY.asc
      

Example 2. A yum Repository Definition File with Failover

To use a list of servers, substitute mirrorlist for baseurl.
Set gpgcheck=0 if it is necessary to disable signature checking for the packages provided by this repository. Avoid distributing or installing unsigned packages.