How to configure NFS server on Centos

NFS(Network File System) is a remote file system protocol that allows you to mount remote directories on your server. use NFS, we can set up file sharing between Unix to Linux system and Linux to Unix system.

Benefit

#NFS allow local access to Remote access.

#no manual refresh allow to add new file.

#can be secured with firewall

Step 1

Configuration  NFS server

[root@xyz ~]# vi /etc/exports

# add *note
/home 192.168.1.0/24(rw,sync,no_root_squash)

# *note
/home   => shared directory
192.168.1.0/24  => range of networks NFS permits accesses
rw    => read and write
sync    => synchronize
no_root_squash  => enable root privilege

[root@xyz ~]# /etc/rc.d/init.d/portmap start
[root@xyz ~]# /etc/rc.d/init.d/nfs start
[root@xyz ~]# /etc/rc.d/init.d/nfslock start
[root@xyz~]# chkconfig nfs on
[root@xyz~]# chkconfig nfslock on
[root@xyz~]# chkconfig portmap on
Step 2

Configuration  NFS clients

[root@www ~]# /etc/rc.d/init.d/portmap start
[root@www ~]# /etc/rc.d/init.d/nfslock start
[root@www ~]# /etc/rc.d/init.d/netfs start
[root@www ~]# chkconfig nfslock on
[root@www ~]# chkconfig portmap on
[root@www ~]# chkconfig netfs on
[root@www ~]# mount -t nfs nfs.server-linux.info:/home /home
[root@www ~]# df -m

# home directory on NFS is mounted

[root@www ~]# vi /etc/fstab

# add at the bottom: change home directory this server mounts to the one on NFS

nfs.server-linux.info:/home /home nfs defaults 1 2

 

 

Posted By: Techguru

Related posts

Leave a Comment