How to configure YUM repository in Linux/Centos/Redhat | YUM in Linux/Centos/Redhat
In this we are going to configure yum repository for local installation of packages. Mainly YUM helps to install the RPM with its redundancy. It prevents to worry about redundancy and updating RPM
I. Make directory /dvd by using following command. This is the mount point for /dev/hdc (this my DVD rom connected at secondary master).
#mkdir/dvd
II.Mount using following command
mount /dev/hdc /dvd
III. Need to copy all rpm’s from CD or DVD to /var/ftp
#cp –a /dvd/Centos/* /var/ftp
IV. For creating repodata we need to download createrepo rpm. Following command to download from terminal.Or use browser to download click HERE. To get the latest release click Here.
# wget http://packages.sw.be/createrepo/createrepo-0.4.6-1.el5.rf.noarch.rpm
#rpm –UVH createrepo-0.4.10-1.el5.rf.noarch.rpm
Or
# rpm –Uvh http://packages.sw.be/createrepo/createrepo- 0.4.6-1.el5.rf.noarch.rpm
V.Once installed use the following command to create the repodata files
#createrepo /var/ftp
VI.Once above done. Move *.repo files from the
#mv /etc/yum.repos.d/* /root/Desktop
Note:
Centos 5:The reason to move is if you don’t have Internet connection when you installing package with yum, which try to resolve the base centos repository file which is located in /etc/yum.repos.d/Centos-xxxx.repo. So it will not install rpm from local repository Above movement helped to install rpm from local repository.If you have Internet connection move it back to original and install rpm with yum.
VII.Edit the /etc/yum.conf file put the following lines at the end.
#vi /etc/yum.conf
[My Repo]
name= My Local Repository
baseurl=ftp://youripaddress —-> for Centos 5
enable=1
gpgcheck=0
VIII.Clean up previous caching by following command. This is important when you are changing repo files or rpm on your repository.
#yum clean all
IX.Install rpm with the following command.
#yum install httpd