How to Add YUM repository to Fedora, RedHat or CentOS linux
YUM is a software management application which was used in CentOS, Fedora and in RedHat. YUM was used for installing binary software by adding repositories in Linux operating system. By default YUM comes as a preinstalled software in CentOS, Fedora and in RedHat for installing and managing packages in this Linux distributions
To install and manage packages in Linux you need to add the repositories. Repositories are nothing but the group of storage place, where you can get the packages for installation and updation in your LINUX operating system.
Repositories can be of any server, from where you can download the packages and install in your operating system. In this article, we are going to see, how to add repositories to CentOS, Fedora and RedHat Linux.
Install Repository from Online:
In order to install the repositories from online without any configuration, you just need to run the following command. This command will fetch the repository configuration from online as a RPM Package and update it into your Linux repositories folders (/etc/yum.repos.d)
# rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
This folder will contain the repository configuration, so that you can download the packages from different repositories which is available online.
Install Repositories Manually:
To install the repositories manually you need to edit the following folder and add the code which was given below
# cd /etc/yum.repos.d
# vi foo
name=Foo for RHEL/ CentOS $releasever - $basearch
After pasting the code in the follow the both file save the code and exit
Here you can see the explanation for the above code.
- [foo] : This section is called as Repository name.
- name=Foo for RHEL/ CentOS $releasever – $basearch : This section is a human readable string that describes the repository name.
- baseurl=http://foo.techken.in/centos/$releasever/$basearch/ : It denotes the URL to the directory where the yum repository’s ‘repodata’ directory lives.
- enabled=1 : Enable or disable repo. [To disable the repository temporarily, set the enabled to 0]
- gpgcheck=1 : Security feature. This section uses GPG key.
- gpgkey=http://foo.techken.in/RPM-GPG-KEY.txt : GPL file location.
Now you need to import the gpg key for the repository by using the below code.
# rpm --import http://foo.techken.in/RPM-GPG-KEY.txt
After completing all the above steps, now you are ready to install software using YUM. You can use the man file [#man yum] to get help of the package.