Wednesday, October 31, 2012

how to add dvd based repository in rhel 6

Problem :- yum install [package..]    gives an error message similar to the following

[root@localhost ~]# yum install gcc
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
...(output ommited)
No package gcc available   <-- here i'm try to install pacakage called 'gcc'
Error: Nothing to do
[root@localhost ~]#

reason is we do not have access to RHN

Solution :- use DVD as base repository

[1]switch to the root

[shehan@localhost ~]$ su -
[root@localhost ~]#

[2]Create DVD based repo

[root@localhost ~]# vim /etc/yum.repos.d/iso.repo

Following text should be added to above file (iso.repo)


DVD based repository rhel 6

[3]mount installation DVD
make a directory called /mnt/cd and it should be similar to baseurl

[root@localhost ~]# mkdir /mnt/cd
[root@localhost ~]# mount /dev/cdrom /mnt/cd

[4]now try previous command again. it should work !
[root@localhost ~]# yum install gcc

tips :- How to  mount iso image ??
baseurl of  " iso.repo " file  should be changed as
file://mnt/iso/Server     ( I created /mnt/iso directory)

mount command is
mount -o loop /home/shehan/redhatiso/h-rel62x6.iso /mnt/iso

1 comment:

Related Posts