1、NFS服务端配置
1)打印系统版本
[[email protected] ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
[[email protected] ~]# uname -r
2.6.32-358.el6.x86_64
[[email protected] ~]# uname -m
x86_64
2)检查并安装NFS服务
rpm -aq nfs-utils portmap rpcbind
LANG=EN
yum grouplist
yum install nfs-utils rpcbind –y
rpm -aq 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/rpcbind start
rpcinfo -p localhost
4)设置开机自启动并检查
chkconfig nfs on
chkconfig rpcbind on
chkconfig --list nfs
chkconfig --list rpcbind
5)配置共享/data目录
[[email protected] ~]# cat /etc/exports
#shared data for web by wenjing at 20151002
/data 192.168.1.1/24(rw,sync)
6)创建共享目录
mkdir /data
ll /data
chown -R nfsnobody.nfsnobody /data
vi a.sh
cp a.sh b.sh
7)平滑加载NFS服务并检查服务
/etc/init.d/nfs reload
showmount -e localhost
2、NFS客户端配置
1)检查系统版本
[[email protected] ~]# hostname nfsclient
[[email protected] ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
[[email protected] ~]# uname -r
2.6.32-358.el6.x86_64
[[email protected] ~]# uname -m
x86_64
2)安装rpc服务
rpm -aq nfs-utils portmap rpcbind
yum groupinstall “NFS file server” –y
yum –aq 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 192.168.1.132
故障排除:
ping 192.168.1.132
telnet 192.168.1.132 111
6)挂载并测试
mount -t nfs 192.168.1.132:/data /mnt
cd /mnt
# ls -l
总用量 0
-rw-r--r-- 1 root root 0 10月 2 16:09 a.sh
-rw-r--r-- 1 root root 0 10月 2 16:09 b.sh
echo "mount -t nfs 192.168.1.132:/data /mnt">>/etc/rc.local