nfs 搭建

环境A,B两台centos7,A ip 192.168.1.2 服务端,B ip 192.168.1.3客户端

A服务器端

##安装
yum install -y nfs-utils rpcbind
##依次启动
systemctl start rpcbind
systemctl start nfs-server
#建立共享目录
mkdir /share
chmod 777 /share
##编辑配置文件 /etc/exports
#括号后默认参数 (ro, root_squash)
#root_squash 当NFS客户端以root管理员访问时,映射为NFS服务器的匿名用户
/share  192.168.1.0/24(rw,no_root_squash,async)
##重新读取配置使之生效
systemctl reload nfs-server

B 客户端

##查看
[root@m1 ~]# showmount -e 192.168.1.2
Export list for 192.168.1.2:
/share 192.168.1.0/24
##挂载
[root@m1 ~]# mkdir /mnt/pub
[root@m1 ~]# mount -t nfs 192.168.1.2:/share  /mnt/pub

Leave a Reply

Your email address will not be published. Required fields are marked *