Topics Summary

 

What are the package, daemon, configuration files and port number?

  • Package               nfs-utils
  • Daemons              rpc.nfsd, rpc.mountd, rpc.statd,rpc.lockd, rpc.rquotad
  • Script                    /etc/init.d/nfs
  • Port number         2049
  • Config file              /etc/exports

 

How to configure NFS server?

Server side configuration:

  • Verify the nfs package is installed or not.
[root@sys1 ~]# rpm -qa | grep nfs

 

If the command returned nothing there is no package installed in the server.

Now install the packages using yum.

[root@sys1 ~]# yum install nfs*

 

  • Now check the status of NFS service.
[root@sys1 ~]# /etc/init.d/nfs status
rpc.svcgssd is stopped
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped

 

From the above output we know that the NFS service is stopped mode.

  • Now start the service as follows.
[root@sys1 ~]# /etc/init.d/nfs start
Starting   NFS services:                                             [ OK ]
Starting   NFS quotas:                                               [ OK ]
Starting   NFS mountd:                                               [ OK ]
Stopping   RPC idmapd:                                               [ OK ]
Starting   RPC idmapd:                                               [ OK ]
Starting   NFS daemon:                                               [ OK ]

 

Now the service is started.

  • I am going to share the /opt directory. Open the file ‘/etc/exports’ and edit the file as follows.
[root@sys1 /]# vi /etc/exports
/repo *(rw,sync,no_root_squash)
/repo is the filesystem in the local disk.

 

In the above entry * indicates that the directory is shared to all the systems.

If we want to share the file system with the particular system in the place of * put the ipaddres of the system.

 

  • After editing the ‘/etc/exports’ file restart the service as follows.
[root@sys1 /]# /etc/init.d/nfs restart
Shutting down NFS daemon:                                           [ OK ]
Shutting down NFS mountd:                                           [ OK ]
Shutting down NFS quotas:                                           [ OK ]
Starting  NFS services:                                             [ OK ]
Starting  NFS quotas:                                               [ OK ]
Starting  NFS mountd:                                               [ OK ]
Stopping  RPC idmapd:                                               [ OK ]
Starting  RPC idmapd:                                               [ OK ]
Starting  NFS daemon:                                               [ OK ]

 

Check the status of the service once.

[root@sys1 /]# /etc/init.d/nfs status
rpc.svcgssd is stopped
rpc.mountd (pid 4380) is running...
nfsd (pid 4445 4444 4443 4442 4441 4440 4439 4438) is running...
rpc.rquotad (pid 4376) is running...

 

The service is running.

  • Turnoff the firewalls as follows.
[root@sys1 /]# /etc/init.d/iptables stop
iptables: Flushing firewall rules:                                   [ OK ]
iptables: Setting chains to policy ACCEPT: filter                    [ OK ]
iptables: Unloading modules:                                         [ OK ]

 

Disable SELinux

[root@sys1 /]# getenforce
Enforcing
[root@sys1 /]# setenforce permissive
[root@sys1 /]# getenforce
Permissive

 

  • To list the file systems which are sharing the command is as follows.
[root@sys1 /]# exportfs -avr
exporting *:/repo

 

In the above command

-a   represents export all directories.

-r   represents reexport al directories

-u   unexports one or more directories.

-v   provides verbose outputs.