多语言展示
当前在线:1024今日阅读:195今日分享:41

如何在CentOS7上安装nfs

NFS主要功能是通过网络让不同的主机系统之间可以共享文件或目录。NFS服务器端共享的目录就好像是客户端自己的磁盘分区或者目录一样。
工具/原料

CentOS7.6

方法/步骤
1

使用两台服务器进行测试

2

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

4

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

5

在server端创建nfs配置文件/etc/exports/data 192.168.20.0/24(rw,async,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 /mnt   192.168.20.234 为服务端的IP地址

8

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

推荐信息