OK, solved!
After installing NFS server, copying all RHEL CDs to a directory, in my case, /inst, we need to edit, /etc/exports file, followed by NFS service reload.
Here are the steps:
###Server Side:
01#mkdir /inst
02#cp -ar /source/. /inst
[note the (.) after /source/]
03#vi /etc/exports
Add line:
/inst *(ro,sync)
04#exportfs -a
05#service nfs restart
06#chkconfig nfs on
07#rpm -ivh createrepo
08#createrepo -v /inst/Server
[/inst/Server => this is the directory where local copy of RPM packages can be found.]
09#vi /etc/yum.repo.d/file.repo
[Server]
name= redhat
baseurl=file:///inst/Server
10#yum clean all
11#yum update (to check)
###Client Side:
Check NFS connection
01#showmount -e [server-IP]
if it shows '/inst' (the shared directory), it's working.
Then we need to mount the directory locally.
02#mount server-IP:/inst/Server /var/yum
Create /var/yum, if it doesn't exist, also notice, /inst/Server at server-side is where all the rpm files are.
Now, edit /etc/yum.repos.d/file.repo
(file.repo or you filename with .repo extension)
03#vi /etc/yum.repos.d/file.repo
baseurl=file:///var/yum
enable=1
04#yum install package
Should work now!
Finally, to make this work after reboot.
#yum install autofs
#vi /etc/auto.master
/misc /etc/auto.misc --timeout=60
(timeout prevents system hanging due to network-error etc.)
#vi /etc/auto.misc
Add line:
yum -ro,soft,intr server-IP:/inst/Server
#service autofs restart
To test the result
#ls /misc/yum
(try few times if in weak network connections)
#yum update
Should now give normal YUM output.
Hope this works for you. Just showed the steps, you may need to do your man-page research for detail.
Thanks, all Linux-People.