Server Side

  1. Disable SeLinux
    Edit the configuration file:

    vi /etc/selinux/config
    

    Modify as follows:

    #SELINUX=enforcing    # Comment out
    #SELINUXTYPE=targeted # Comment out
    SELINUX=disabled      # Add this line
    

    Then reboot the system:

    reboot  # Restart the system
    
  2. Create a Directory
    Using the root user, create a directory named /nfs. Note: It’s best to check which partition has the most space by running df, as the root (/) partition may not have the most space. In some automatic partitioning setups, the /home partition may have the most space.

  3. Install NFS Utilities and RPC Bind

    yum -y install nfs-utils rpcbind
    
  4. Enable Services at Boot

    chkconfig nfs on
    chkconfig rpcbind on
    chkconfig nfslock on
    
  5. Configure Exports
    Edit the NFS exports file:

    vi /etc/exports
    

    Add the following line:

    /home/nfs 192.168.1.0/24(rw,sync,no_all_squash)
    
  6. Start NFS Services

    service rpcbind start
    service nfs start
    service nfslock start
    exportfs -a
    
  7. Configure NFS Ports
    Edit the NFS configuration file:

    vi /etc/sysconfig/nfs
    

    Uncomment the following lines:

    LOCKD_TCPPORT=32803
    LOCKD_UDPPORT=32769
    MOUNTD_PORT=892
    
  8. Restart NFS Services

    service rpcbind restart
    service nfs restart
    service nfslock restart
    
  9. Verify RPC Services

    rpcinfo -p localhost
    

    Note down the ports and their types.

  10. Configure Firewall Rules
    Adjust the IP range according to your network:

    iptables -I INPUT -m state --state NEW -p tcp -m multiport --dport 111,892,2049,32803 -s 192.168.0.0/24 -j ACCEPT
    iptables -I INPUT -m state --state NEW -p udp -m multiport --dport 111,892,2049,32769 -s 192.168.0.0/24 -j ACCEPT
    
  11. Save Firewall Rules
    Test from the client side. If successful, save the iptables configuration:

    service iptables save
    

Client Side

  1. Create Mount Point

    mkdir /nfs
    
  2. Check RPC Services on Server

    rpcinfo -p [server_ip]
    
  3. Show NFS Exports

    showmount -e [server_ip]
    
  4. Mount NFS Share

    mount -t nfs -o soft,intr,bg,rw [server_ip]:/home/nfs /nfs
    
  5. Unmount NFS Share

    umount /nfs
    
  6. Configure Automatic Mounting
    Edit the fstab file:

    vi /etc/fstab
    

    Add the following line:

    [server_ip]:/home/nfs /nfs nfs soft,intr,bg,rw 0 0