NFS服务搭建

久未见 提交于 2019-12-26 16:03:53

NFS服务搭建

准备两台虚拟机,服务端和客户端。
IP分别是192.168.1.145 192.168.1.234

操作服务端:

[root@localhost ~]# yum -y install nfs-utils rpcbind
编辑配置文件。
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# cat /etc/exports
/home/xxx 192.168.1.234(rw)
[root@localhost ~]# mkdir /home/xxx
[root@localhost ~]# chmod 777 /home/xxx
开启服务(开启顺序不能变)。
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
关闭防火墙,降低沙盒。
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

操作客户端:

[root@localhost ~]# yum -y install nfs-utils rpcbind
开启服务。
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
查看虚拟机能否连通。
[root@localhost ~]# ping 192.168.1.145
PING 192.168.1.145 (192.168.1.145) 56(84) bytes of data.
64 bytes from 192.168.1.145: icmp_seq=1 ttl=64 time=2.91 ms
64 bytes from 192.168.1.145: icmp_seq=2 ttl=64 time=1.60 ms
64 bytes from 192.168.1.145: icmp_seq=3 ttl=64 time=0.504 ms
连接服务端IP。
[root@localhost ~]# showmount -e 192.168.1.145
Export list for 192.168.1.145:
/home/xxx 192.168.1.234
关闭防火墙,降低沙盒。
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
挂载服务端的共享目录并用df查看。
[root@localhost ~]# mount -t nfs 192.168.1.145:/home/xxx /mnt
[root@localhost ~]# df -h
在这里插入图片描述
:如要重启服务要先关闭rpcbind,再关闭nfs,之后开启rpcbind后开启nfs,顺序不能错。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!