首页 > 技术文章 > CentOS7中搭建nfs

spring1122 2020-02-21 14:19 原文

1、准备2台虚机

服务器:192.168.2.17

客户端:192.168.2.179

2、在服务器上安装nfs服务

yum install nfs-utils

 

 

 

查看是否安装nfs:rpm -qa nfs-utils

 

 

 

3、查看rpc服务是否自动启动:ss -tnulp | grep 111,没启动就启动服务systemctl start rpcbind

 

 

 

4、编辑/etc/exports,添加

   /data/nfs/ 192.168.2.0/24(rw,async)

 

5、启动nfs服务:systemctl start nfs,启动后使用rpcinfo –p 192.168.2.17查看

 

 

 

6、使用showmount -e localhost

 

 

 

7、在/data/nfs/目录中添加文件,更改权限

 

 

 

 

接下来去客户端操作,客户端上不需要启动nfs服务,只是为了使用showmount工具

8、安装nfs

 

 

 

9、检测rpc是否启动

 

 

 

10、使用showmount查看NFS服务器的相关信息

 

 

 

11、挂载到本地/mnt目录

 

 

 

12、在本地读写文件

 

 

推荐阅读