准备一台服务器192.168.1.100和一台客户端192.168.1.101 首先在服务器安装nfs-ntils和rpcbind

[[email protected] ~]# yum -y install nfs-utils rpcbind

修改配置文件,允许客户端访问

[[email protected] ~]# vim /etc/exports
/home/gxb192.168.1.101/24(rw,no_root_squash,no_all_squash,sync)

创建目录并增加权限

[[email protected] ~]# mkdir -p /home/gxb
[[email protected] ~]# chmod 777 /home/gxb/

开启服务,开启的顺序不能改变

[[email protected] ~]# systemctl start rpcbind
[[email protected] ~]# systemctl start nfs

关闭防火墙,降低沙盒等级

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0

在客户端安装nfs-ntils和rpcbind

[[email protected] ~]# yum -y install nfs-utils rpcbind

开启服务

[[email protected] ~]# systemctl start rpcbind
[[email protected] ~]# systemctl start nfs

检查客户端和服务端的网络是否连通

NFS的搭建(linux-linux)

关闭防火墙,降低沙盒等级

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0

挂载服务端的共享目录并用df检测

[[email protected] ~]# mount -t nfs 192.168.1.100:/home/gxb /mnt
[[email protected] ~]# df -h

NFS的搭建(linux-linux)
附:如要重启服务要先关闭rpcbind,再关闭nfs,之后开启rpcbind后开启nfs,顺序不能错

相关文章: