我是靠谱客的博主 不安心情,这篇文章主要介绍Linux下实现NFS挂载,现在分享给大家,希望可以做个参考。


1.判断linux是否安装了nfs服务 rpm -qa|grep nfs

2.配置/etc/exports文件。

添加:  /root/script 192.168.1.204(insecure,rw,async,no_root_squash)

3.关闭防火墙:service iptables stop 可能使用的端口号

-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT

4.设置被远程访问文件的读写权限:chmod 755 /root/script

5.启动服务:

service nfs start

 

204客户端

1.创建空文件夹file,用于挂载服务器文件

service rpcbind start

2.使用mount命令挂载文件:

mount 192.168.1.223:/root/script /filePath

 

两个nfs服务不能挂载到同一路径下

 

服务器在关闭nfs之前,应先取消客户端的挂载,否则客户端访问会出现卡死情况:umount /filePath

如果客户端取消挂载失败:fuser -km /filePath 取消连接

然后连接客户端执行命令:umount /filePath

最后关闭服务器nfs服务

最后

以上就是不安心情最近收集整理的关于Linux下实现NFS挂载的全部内容,更多相关Linux下实现NFS挂载内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(120)

评论列表共有 0 条评论

立即
投稿
返回
顶部