How to add local http yum repository?
Follow the steps below:
1. Mount your RedHat/CentOS installation dvd, automatically it will be mount under /media/.
2. Make a directory under /var/www/html/ called "repo".
mkdir /var/www/html/repo
3. Copy all dvd contents to /var/www/html/repo/
rsync -arv /media/CentOS_6.3_Final/ /var/www/html/repo
4. Install createrepo using rpm in /var/www/html/repo/Packages/
[root@master Packages]# rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm
error: Failed dependencies:
deltarpm is needed by createrepo-0.9.8-5.el6.noarch
python-deltarpm is needed by createrepo-0.9.8-5.el6.noarch
[root@master Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@master Packages]# rpm -ivh pyt
Display all 114 possibilities? (y or n)
[root@master Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[root@master Packages]# rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
4. Create a repository metadata file in /var/www/html/repo/
createrepo .
5. Add new yum repo in /var/yum.repos.d called "local-http.repo", and insert this entry:
[root@master ~]# cat /etc/yum.repos.d/local-http.repo
[local-http]
name=Local HTTP Repo For CentOS $releasever $basearch
baseurl=http://localhost/repo/
enabled=1
gpgcheck=0
6. Clear yum cache
yum clean all
7. List current yum repo
yum repolist
Thanks