安装NFS

服务端:

(1)安装NFS软件包

#yum install nfs-utils rpcbind -y

(2)保留yum安装的rpm

#vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0  <==将0改为1保留yum安装的rpm包

启动NFS相关服务

1、启动rpcbind服务

# /etc/init.d/rpcbind start

2、启动NFS服务

# /etc/init.d/nfs start

配置NFS服务器服务开机自启动

#chkconfig rpcbind on
#chkconfig nfs on

配置NFS配置文件

cat >>/etc/exports <<EOF
#share /data by xiaoxin for lianxi at 2016.07.28
/data 172.16.1.0/24(rw,sync)
EOF
exportfs -rv <==加载配置文件
vim /var/lib/nfs/etab
/data 172.16.1.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,\
no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,\
no_all_squash)

创建共享的目录并授权

mkdir /data
chown -R nfsnobody.nfsnobody /data


客户端

yum install nfs-utils rpcbind -y
/etc/init.d/rpcbind start
chkconfig rpcbind on

挂载

mount -t nfs 10.0.0.7:/data /mnt