To install createrepo, mount the iso and type the following commands...
# mkdir -p /mnt/repo/{1,centoscd}Now copy the contents from iso to /mnt/repo/centoscd
# mount -o loop /path/to/centos.iso /mnt/repo/1
# rpm -ivh /mnt/repo/1/CentOS/createrepo*.rpm
# cp -rpf /mnt/repo/1/* /mnt/repo/centoscd/
Now create the repository
# cd /mnt/repo
# createrepo .To clean existing repo cache enter
# yum clean all
Create config file
Add the following text in /etc/yum.repos.d/localiso.repo
Add the following text in /etc/yum.repos.d/localiso.repo
[My-local-repository]Before installing packages GPG key needs to be imported
baseurl=file:///mnt/repo
enabled=1
# rpm --import /mnt/repo/centoscd/RPM-GPG-KEY-CentOS*
Now use yum command to install packages
# yum install package-name