首先检查一下NFS包是否已经安装。

[root@CSA-Linux-001 Desktop]# rpm -qa|grep nfs-utils
nfs-utils-lib-1.1.5-4.el6.x86_64
nfs-utils-1.2.3-26.el6.x86_64
如果没有安装则使用yum进行安装

[root@CSA-Linux-001 Desktop]# yum install nfs-utils

NFS服务依赖于rpcbind服务,因为在启动nfs服务之前先启动rpcbind

[root@CSA-Linux-001 Desktop]# service rpcbind start
Starting rpcbind:                                          [  OK  ]
然后再启动NFS服务

[root@CSA-Linux-001 Desktop]# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:
NFS的配置文件是 /etc/exports,格式如下:

每一行定义一个共享目录,每一行的每个字段如下。

需要共享的目录,如/share目录

需要共享给哪些人,如机器名,或者ip地址,ip网段

客户端挂接的参数如rw,ro,sync, async,no_root_squash

example:

/share   *(rw,asyn,no_root_squash)