标签:service 服务器 access linux nfs
nfs为网络文件系统也可理解为文件共享,方式为服务器上安装nfs服务,客户端通过挂在的方式把服务器上的目录挂载到本地,实现文件共享
1.查看有没有安装nfs
rpm -qa |grep nfs
2.安装nfs
yum -y install nfs-utils
3.开启服务
/etc/init.d/nfs start
/etc/init.d/rpcbind start
4.配置exports
vi/etc/exports
/home/zuzhao 192.168.1.0 255.255.254.0(rw)
5.关闭防火墙
service iptbales stop
7.重启nfs
service nfs restart
8.服务器目录改写权限
chmod 777 /home/zuzhao
9.客户端进行挂载
mount -t nfs 192.168.1.52:/home/zuzhao//tmp/zuzhao/
报错
mount.nfs: access denied by server whilemounting 192.168.1.52:/home/zuzhao/ You have new mail in /var/spool/mail/root
查看报错日志
cat /var/log/messages |grep mount
报错日志截图如下
Dec 21 14:29:04 CactiEZ rpc.mountd[1770]:Failed to register (mountd, 3, tcp6): svc_reg() err: RPC: Remote system error -Connection refused
提示为端口太大的原因服务器查看端口如下
netstat -apn | grep mount
[root@localhost zuzhao]# netstat -apn | grepmount
tcp 0 0 0.0.0.0:36220 0.0.0.0:* LISTEN 26820/rpc.mountd
tcp 0 0 0.0.0.0:36162 0.0.0.0:* LISTEN 26820/rpc.mountd
tcp 0 0 0.0.0.0:54157 0.0.0.0:* LISTEN 26820/rpc.mountd
tcp 0 0 :::37660 :::* LISTEN 26820/rpc.mountd
tcp 0 0 :::54600 :::* LISTEN 26820/rpc.mountd
tcp 0 0 :::52239 :::* LISTEN 26820/rpc.mountd
udp 0 0 0.0.0.0:38960 0.0.0.0:* 26820/rpc.mountd
udp 0 0 0.0.0.0:51648 0.0.0.0:* 26820/rpc.mountd
udp 0 0 0.0.0.0:32975 0.0.0.0:* 26820/rpc.mountd
udp 0 0 :::47082 :::* 26820/rpc.mountd
udp 0 0 :::41836 :::* 26820/rpc.mountd
udp 0 0 :::59969 :::* 26820/rpc.mountd
解决方法如下:
修改配置文件
vi /etc/exports
/home/zuzhao *(insecure,rw,async,no_root_squash)
添加如上
重启nfs服务
重新挂载
[root@CactiEZ tmp]# mount -t nfs192.168.1.52:/home/zuzhao/ /tmp/zuzhao/
You have new mail in /var/spool/mail/root
[root@CactiEZ tmp]# ls
cactiez ins.log ks-script-KlcQlI ks-script-KlcQlI.log yum.log zuzhao
[root@CactiEZ zuzhao]# ls
1.txt
[root@CactiEZ zuzhao]#
完成!
本文出自 “tigase安装与测试” 博客,请务必保留此出处http://jiazuzhao.blog.51cto.com/1123655/1885511
标签:service 服务器 access linux nfs
原文地址:http://jiazuzhao.blog.51cto.com/1123655/1885511