NFS(Network File System 网络文件服务)
NFS 是一种基于 TCP/IP 传输的网络文件系统协议,最初由 Sun 公司开发。
通过使用 NFS 协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源
特点:
采用TCP/IP传输网络文件
安全性低
简单易操作
适合局域网环境
搭建过程
1
2.用echo命令来识别硬盘
3.分区
4.硬盘格式化
5.挂载硬盘
6.关闭防火墙和selinux,并安装软件包
7.服务端创建共享目录t添加文件并修改exports文件
8. 修改权限
9.编辑配置文件
10.开启服务
11.exportfs -v,查看详细信息
12.客户端 showmount -e server_ip
13
将共享目录挂载并查看
14.查看挂载
15.测试使用
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
#安装软件包
[root@localhost ~]# yum install nfs-utils.x86_64 rpcbind -y
#新建共享目录
[root@localhost ~]# mkdir /share
[root@localhost ~]# cd /share/
#修改权限
[root@localhost share]# chmod -R 777 /share/
#编辑配置文件
[root@localhost share]# vim /etc/exports
/share *
/share 192.168.91.0/24(rw,sync,no_root_squash)
#共享目录 网段 读写,同步,无root权限
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
#查看详细的nfs信息
[root@localhost share]#exportfs -v
#重读配置文件
[root@localhost share]#exportfs -r
#查看本机发布的 NFS 共享目录
[root@localhost ~]# showmount -e
2.客户端
#挂载服务器至本地文件夹
[root@localhost ~]# mount 192.168.59.102:/share /mnt
#查看是否挂载成功
[root@localhost ~]# df -Th
3.测试
#服务器端在共享文件夹下创建目录
[root@localhost share]# cd /share/
[root@localhost share]# touch 1.txt
#在客户端的挂载目录下查看是否成功看到文件
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
1.txt