文件共享服务器nfs搭建过程

网络文件共享服务器192.10.18.132
yum install -y nfs-utils

在exports文件中添加的从机范围
vim /etc/exports
/home/nfs/ 192.10.18.0/24(rw,sync,fsid=0)

rw表示可读写;sync表示同步写,fsid=0表示将/data找个目录包装成根目录
先为rpcbind和nfs做开机启动:(必须先启动rpcbind服务)
systemctl enable rpcbind.service
systemctl enable nfs-server.service
然后分别启动rpcbind和nfs服务:
systemctl start rpcbind.service
systemctl start nfs-server.service

exportfs -r
#使配置生效

exportfs
#可以查看到已经ok
/home/nfs 192.10.18.0/24


192.10.18.136
接着从机
yum install -y nfs-utils

先为rpcbind做开机启动:
systemctl enable rpcbind.service
然后启动rpcbind服务:
systemctl start rpcbind.service
注意:客户端不需要启动nfs服务

检查 NFS 服务器端是否有目录共享:showmount -e nfs服务器的IP
showmount -e 192.10.18.132

cd /home/ && mkdir /nfs

挂载
mount -t nfs 192.10.18.132:/home/nfs /home/nfs

查看
df -h
原文地址:https://www.cnblogs.com/Liang-jc/p/9264405.html