redhat yum from iso

Today I picked up Redhat again for the RHCE exam is coming soon.

After installing the basic system, meet problem, I need to do some DNS practice. But I don't like install the rpm package from DVD, I just want to yum it from the ISO source. So in order to make a good practice environment. I did the following steps:

1. mount the ISO file first and make it startup by system every time.

[root@redhat ~]# mkdir /mnt/win   # I want to mount windows partition to win folder

[root@redhat ~]# mkdir /mnt/iso   # I want to mount RHEL5 ISO to iso folder

[root@redhat ~]# chmode -R 777 /mnt/win /mnt/iso  # make sure there's enough privilage to access these two folders

[root@redhat ~]# fdisk -l   # Display all the partition

From the /etc/fstab, add this line:

/dev/hda1               /mnt/win                ntfs    umask=000       0 0  # This means to mount the NTFS partition when system startup

in /etc/rc.d/rc.local, add this line:

mount -o loop /mnt/win/ISO/rhel-5-server-i386-dvd.iso /mnt/iso  # This means to mount ISO file to /mnt/iso folder when system startup

[root@redhat ~]# mount -a

[root@redhat ~]# /etc/rc.local  # These two lines means to mount NTFS partition to /mnt/win first, then mount ISO file to /mnt/iso



2. Edit the repo file to make iso as yum source.

[root@redhat ~]# cd /etc/yum.repos.d

[root@redhat ~]# cp rhel-debuginfo.repo rhel-debuginfo.repo.bak  # Backup the default repo file

[root@redhat ~]# vim rhel-debuginfo.repo

edit the repo file like this:

[Server]
name=Red Hat Enterprise Linux ISO image
baseurl=file:///mnt/iso/Server/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=VT
baseurl=file:///mnt/iso/VT/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Please pay attention to the path. After finish the repo file. you can use yum, but first you must check the update

[root@redhat ~]# yum check-update  # If you find there are several 100% and no error, then everything will be fine!

[zz]http://zhouxuesong1980.blog.163.com/blog/static/76945154200932821525820/

猜你喜欢

转载自leongfans.iteye.com/blog/1231125