7. Using Other Software Repositories
CentOS systems automatically use the CentOS Project repositories. These include [base], [updates], [addons], [centosplus], [contrib], [extras], and [testing]. Some of these repositories are not enabled by default, because they might change core packages. The enabled repositories are [base], [updates], [addons], and [extras]. For more information about what each repository does see Section 2.2 About Repositories
For information specifically about using the centosplus repository see the CentOS Plus readme
If the CentOS Project does not supply packages for a product, the
manufacturer may provide or recommend a separate repository.
Members of the community also maintain repositories to provide
packages for CentOS systems. For example,
https://www.jpackage.org/ distributes popular Java
software as packages.
7.1. Adding a Repository as a Package Source
To add an extra repository, place a definition file in the
/etc/yum.repos.d/
directory on your system.
Package providers make the definition files for their
repositories available on their web sites.
| Definition File Extension |
---|
The names of repository definition files end with
.repo .
|
You must have root
access to add a file to the definitions directory. To copy the
definition file example.repo
, type this
command:
su -c 'cp example.repo /etc/yum.repos.d/'
At the prompt, enter the password for the
root
account.
The configuration file for each repository should include a
gpgkey
setting. This setting specifies the
location of a public key that verifies the packages provided by
that repository. This public key is automatically imported the
first time that you install software from the repository. If the
configuration file provided does not include this setting, refer
to Section 7.2, “Manually Authorizing Package Sources”.
| Repositories and up2date Channels |
---|
Starting with CentOS 3, and continuing in CentOS 4, the default yum repositories are
automatically used as up2date
channels. If you want to add other channels for up2date, you must manually configure up2date to use these
channels. To do so, edit the
/etc/sysconfig/rhn/sources file.
|
7.2. Manually Authorizing Package Sources
To manually add a public key to your rpm
keyring, use the import
feature of the
rpm
utility. To import the file
GPG-PUB-KEY.asc
, type the following
command:
su -c 'rpm --import GPG-PUB-KEY.asc
'
At the prompt, enter the password for the
root
account.
You may also import public keys directly from a web site. For
example, to import the file GPG-PUB-KEY.asc
on the web site www.therepository.com
use this command:
su -c 'rpm --import https://www.therepository.com/GPG-PUB-KEY.asc
'
At the prompt, enter the
root
password.
| Importing the CentOS Key on CentOS 3 and CentOS 4 |
---|
To add the CentOS public key to the rpm
keyring on CentOS 3 systems, run the command: su -c
'rpm --import https://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-3'
For CentOS 4 systems use the command: su -c
'rpm --import https://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4'
|
7.3. Understanding Repository Compatibility
Third-party packages should be
compatible with these CentOS Project packages, unless the provider
specifically states otherwise.
Always read the web site of the repository for information on
package compatibility before you add it as a package source.
Separate repository providers may offer different and
incompatible versions of the same software. Third-party
repositories may also provide alternative packages for software
that is included in CentOS repositories.
Alternative packages may contain versions of the software that
function differently from the version in the CentOS Project packages.
Determine the benefits and potential incompatibilities before
replacing CentOS Project packages with alternative versions.
| Incompatible Repositories |
---|
If you configure your system to use incompatible repositories
yum operations may fail.
|
Packages built for one version of CentOS are usually not
compatible with other versions of CentOS. The web site of the
provider should specifically state which versions of CentOS they
support.
| Old Versions of yum and Current Repositories |
---|
The data format for repository indexes changed with version
2.1 of yum . This was the version supplied
with CentOS 4. Repository providers should specify the versions
of CentOS that they support. To confirm that an unlabeled
repository is compatible with CentOS 4 versions of
yum , check that it has a sub-directory
called repodata/ . For CentOS 3 versions of yum, you are looking for the directory called headers/ .
|