At home I am having very slow internet connection, which becomes pain while downloading packages with yum. To make this process faster I have created local repository from CentOS media.
After installing CentOS you should have /etc/yum.repos.d/CentOS-Media.repo. We will be using the same repo file to create our local repository. Adjust the existing repo file as per our need
# CentOS-Media.repo # # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-5. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c5-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c5-media [command] [c5-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/ gpgcheck=0 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Now we need to mount cdrom to /media/CentOS/ or /media/cdrom/ or /media/cdrecorder/. I am having iso image of CentOS, so I will be mounting the same image at /media/cdrom
mount CentOS.iso /media/cdrom -o loop
How to use:
yum --enablerepo=c5-media install package_name