Monday, June 1, 2009

RHEL/CentOS NFS installation

To install Linux over NFS, you need to have NFS server setup. Follow the below steps carefully.

  • first locate and edit /etc/exports with the preferred NFS path.
  • vim /etc/exports -> put the path. Let say, /var/ftp/pub/CentOS-5.2

NOTE :- For file editing you can use your favorite file editor. In this case I’m using “vim”, which I’m very much comfortable with. In your case it might be some thing else. Can be either nano , emacs OR gedit. If you newbie, then I’m recommending gedit for you.

vi/vim, is a very powerful text editor available under Linux, which is my personal favourite. If you are new to vim and want to try out, type “vimtutor” in your shell.

Back on NFS again…..

  • exportfs -ua -> will umount all exported file systems
  • exportfs -ra -> will remount all exported file systems
  • showmount -e hostname -> will list all exported file systems in hostname

If iptables ON, nfs probably won’t work. Most probably your nfs ports must be blocked by firewall. First clarify whether the firewall is turned on OR off in you machine.

  • service iptables status – will give the iptables status

If iptables turned on, then get a list of applied iptables rules. To do so,

  • iptables -L | less – will list current iptables rules.

If you see four strings in the below format, probably nfs might work over the firewall for you.

iptables -A INPUT -s 192.x.x.x/24 -p tcp –dport 111 -j ACCEPT
iptables -A INPUT -s 192.x.x.x/24 -p udp –dport 111 -j ACCEPT
iptables -A INPUT -s 192.x.x.x/24 -p tcp –dport 2049 -j ACCEPT
iptables -A INPUT -s 192.x.x.x/24 -p udp –dport 2049 -j ACCEPT
NOTE :- IP addresses used here are belong to IPV4 private ranges. Replace it with yours.

If not we need to allow nfs over iptables. To allow NFS over iptables :-

  • iptables -A INPUT -j ACCEPT

NOTE :- More general rule that will allow all incoming traffic through the firewall. Later I’ll discuss NFS over firewall in much detail in a up-coming post.

  • service iptables save; restorecon -R /etc/sysconfig/* – will save iptables settings and restore selinux context.
  • service iptables restart.

nfs should be OK over iptables by now. Let’s get start the installation.

Start system with the help of the boot CD/DVD. In the boot: prompt, Either you can press enter and go ahead with booting the system, which later prompt for the installation method OR Press F2 and go to options and invoke “linux askmethod”. In each you’ll be asked to select language , keyboard , and installation method. Select “NFS” for installation method.

To Configure TCP/IP, you can use either static IP or DHCP. If you have DCHP server in place use DHCP or use a correct static IP.

NOTE :- you will find DHCP settings in a up coming post.

In NFS setup ->

under the nfs server name : use name OR IP of the NFS server
under the CentOS/RHEL directory : /use/correct/path/

If everything went right system should start the installation.

No comments:

Post a Comment