Steps to add a new yum repository to install software under CentOS / Redhat Linux:
CentOS / Fedora Core / RHEL 5 uses yum for software management. YUM-Yellowdog Updater, Modified is an open-source command-line package-management utility.
In this article we are going to see the steps involved in adding a new yum repository.
For example, consider that we are going to install a 3rd party repository from foo.nixcraft.com.
1. cd /etc/yum.repos.d
2. Create a file using your favorite text editor.
3. Add the following code:
name=testrepo for RHEL/ CentOS $releasever – $basearch
[testrepo] : Repository name i.e. The [main] section must exist for yum to do anything.
name= testrepofor RHEL/ CentOS $releasever – $basearch : A human readable string describing the repository name.
baseurl=http://foo.nixcraft.com/centos/$releasever/$basearch/ : Must be a URL to the directory where the yum repository’s ‘repodata’ directory lives
enabled=1 : Enabled or disabled repo. To disable the repository temporarily, set the enabled to 0
gpgcheck=1 : Security feature, use GPG key
gpgkey=http://foo.nixcraft.com/RPM-GPG-KEY.txt : GPL file location
4. Import the gpg key for the repository:
rpm –import http://foo.nixcraft.com/RPM-GPG-KEY.txt
5. Now you can proceed with the installation of software from testrepo repository.