NFS 网络文件系统 C/S
rpc 111 远程过程调用机制
S:设置一个共享目录
C:挂载使用这个共享目录 mount
服务器
yum -y install nfs-utils rpcbind //安装nfs和rpc
[root@yum ~]# mkdir /data //创建公共文件夹
[root@yum ~]# vim /etc/exports //修改配置文件
[root@yum ~]# cat /etc/exports
/data 192.168.2.0/24(rw) //允许查看的网段与权限
[root@yum ~]# systemctl start rpcbind //切记 首先开启rpc服务 在开启nfs
[root@yum ~]# systemctl enable rpcbind
[root@yum ~]# systemctl start nfs
[root@yum ~]# systemctl enable nfs
警告服务器必须关闭防火墙
systemctl stop firework
setenforce 0
iptables -F
客户机
[root@www ~]# yum -y install nfs-utils //可以不用安装nfs 但是安装这个 是为了showmount 命令
[root@www ~]# showmount -e 192.168.2.30 //服务器的IP地址
[root@www ~]# mount 192.168.2.30:/data /opt/ // opt是 挂载点 可以在里面找到 服务器共享的文件
[root@www ~]# vim /etc/fstab
192.168.2.30:/data /opt nfs defaults,_netdev 0 0
/var/ftp/ 下是共享根目录 可以分享
本文详细介绍了如何通过NFS(网络文件系统)在服务器上设置共享目录,并在客户端进行挂载使用的过程。包括安装nfs-utils和rpcbind,配置exports文件,启动和启用rpcbind及nfs服务,以及在客户端安装nfs-utils并使用showmount命令检查服务器共享目录,最后将共享目录挂载到本地。
1157

被折叠的 条评论
为什么被折叠?



