centos7 NFS网络文件系统搭建

NFS,是Network File System的简写,即网络文件系统。网络文件系统是FreeBSD支持的文件系统中的一种,也被称为NFS. NFS允许一个系统在网络上与他人共享目录和文件。通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件。

服务端:

yum -y install nfs*

yum -y install showmount

编辑文件 # vim /etc/exports

编辑内容
/共享目录 内网或者公网ip(rw,sync)

查看端口是否开放

netstat -antpu | grep 2049

启动nfs和rpcbind 服务

systemctl enable nfs

systemctl start nfs

systemctl enable rpcbind

systemctl start rpcbind

再次查看端口2049

netstat -antpu | grep 2049

客户端:

showmount -e 服务端ip

出现可用挂载时,
编辑fstab

vim/etc/fstab

添加一行保存退出:
内网/外网ip:/共享的目录 /共享的目录 nfs defaults 0 0

自动挂载 :

mount -a

查看挂载信息:

df -h

猜你喜欢

转载自blog.51cto.com/qq512430/2124977