1, configure the YUM source to the instructor location.

in the folder, '/etc/yum.repos.d', create the file,

vim serverX.repo

the content is as:

【serverX】
name=serverX
baseurl= the location of the YUM source

in my case the location of YUM source is "= http://instructor.example.com/pub/rhel6/dvd"
make sure you have network connection to http://instructor.example.com/pub/rhel6/dvd, this has already been done before.
enabled=1

gpgcheck=0 (without the gpg check)

Set the YUM source at Instructor computer, first insert the CentOS ISO image into the VirtualBox, as below,

RHCE6 Preperation (2) - yum source and auto mount_linux


set the automatic mount the CentOS ISO image by editing the configuration file, /etc/fstab, below is the result of command "cat /etc/fstab"

RHCE6 Preperation (2) - yum source and auto mount_vim_02


reboot the computer,

​reboot​

the last line as: "/dev/cdrom /var/ftp/pub/rhel6/dvd iso9660 auto,ro 0 0"

the folder /var/ftp/pub is linked to /var/www/html/pub, as below picture shows,

RHCE6 Preperation (2) - yum source and auto mount_auto mount_03


so this DVD file can be accessed by http protocol from the student computer. Below pic shows the link:

RHCE6 Preperation (2) - yum source and auto mount_vim_04

2, set the selinux as enforcing mode,

edit the file /etc/sysconfig/selinux

SELINUX=enforcing

needs to reboot for SELinux take effect.

3,  enable the firewall,

iptables -F
iptables -X
iptables -Z
service iptables save

4, mount the example.iso to /mnt/iso, and auto mount at system boot time,

mkdir /mnt/iso
mount -o loop /root/examine.iso /mnt/iso

Write into the fstab file,

vim /etc/fstab
/root/examine.iso /mnt/iso iso9660 defaults,loop 0 0

to test the result,

mount -a
df -h


5, showmount -e localhost to show the directory shared in your system

if the command didn't display anything, means the NFS service didn't start,

if NFS service start fail, means rpcbind service didn't start,

service rpcbind start
service nfs start
showmount -e localhost