如何在CentOS7上安装nfs
1、使用两台服务器进行测试


2、在服务端和客户端安装软件[root@nfs-server ~]# yum install nfs-utils rpcbind -y[root@nfs-client ~]# yum install nfs-utils rpcbind -y

3、开启nfs服务,rpcbind已默认开启。[root@nfs-server ~]# systemctl start nfs.servi艘早祓胂ce检查rpc服务是否有nfs的信息[root@nfs-server ~]# rpcinfo -p localhost

4、客户端只需要开启rpcbind。[root@nfs-client ~]# systemctl start rpcbind.socket

5、在server端创建nfs配置文件/etc/exports/data 192.16呖分甾胗8.20.0/24(rw,asy荏鱿胫协nc,no_root_squash,no_all_squash)rw:读写async:写入数据到磁盘为异步方式no_root_squash: 如果是访问共享目录的用户是root,也不压缩为匿名用户no_all_squash:不管访问共享目录的用户身份,都不压缩为匿名用户

6、服务端重启nfs服务[root@nfs-server ~]# systemctl restart nfs.service客户端检查服务是否正常[root@nfs-client ~]# showmount -e 192.168.20.234


7、客户端开始使用服务端提供的/data目录挂载到客户端[root@nfs-client ~]# mount -t nfs 192.168.20.234:/data /mnt192.168.20.234为服务端的IP地址

8、在里面创建一个文件测试是否正常[root@nfs-client ~]# cd /mnt/[root@nfs-client mnt]# touch nihao.txt
