环境:

nfs服务器IP:10.0.0.8

nfs客户端IP:

################# NFS服务器端 ##################

1、打印系统版本:

hostname nfsserver

cat /etc/redhat-release

uname -r

uname -m


2、检查并安装NFS服务:

rpm -qa nfs-utils portmap rpcbind

yum grouplist

yum install nfs-utils rpcbind -y

rpm -qa nfs-utils portmap rpcbind


3、启动RPC及NFS服务并检查:

/etc/init.d/rpcbind start

ps -ef|grep rpc

/etc/init.d/rpcbind status

rpcinfo -p localhost

/etc/init.d/nfs start

rpcinfo -p localhost


4、设置开机自启动并检查:

chkconfig nfs on

chkconfig rpcbind on

chkconfig --list nfs

chkconfig --list rpcbind


5、配置共享/data目录:

cat >>/etc/exports<<EOF

########shared data for bbs by liyq at 20150614

/data 10.0.0.0/24(rw,sync,all_squash)         =====>all_squash必须加,否则客户端普通用户会造成权限的困扰

EOF

cat /etc/exports


6、创建共享目录:

mkdir /data

ll /data

chown -R nfsnobody.nfsnobody /data


7、平滑加载共享NFS服务并检查服务:

/etc/init.d/nfs reload

showmount -e localhost


8、写入开机自启动

echo "/etc/init.d/rpcbind start" >>/etc/rc.local

echo "/etc/init.d/nfs start" >>/etc/rc.local


################## NFS客户端######################

1、检查系统版本:

hostname nfsclient

cat /etc/redhat-release

uname -r

uname -m


2、安装RPC服务并检查:

rpm -qa nfs-utils portmap rpcbind

yum install nfs-utils rpcbind -y          =====>或者yum groupinstall "NFS file server" -y

rpm -qa nfs-utils portmap rpcbind


3、启动RPC服务并检查:

/etc/init.d/rpcbind start

/etc/init.d/rpcbind status


4、设置开机自启动并检查:

chkconfig rpcbind on

chkconfig --list rpcbind


5、检查服务端的NFS是否OK:

showmount -e 10.0.0.8

排查故障

ping 10.0.0.8

telnet 10.0.0.8 111


6、挂载并测试:

mount -t nfs 10.0.0.8:/data /mnt

cd /mnt

ls -l

touch liyq.log

ls -l


7、写入开机自启动

echo "mount -t nfs 10.0.0.8:/data /mnt" >>/etc/rc.local