NFS共享存储服务:
使用NFS发布共享资源
在客户端访问NFS共享
NFS客户端mount的挂载
NFS网络文件系统
依赖于RPM(远端过程调用)
需要安装nfs-utils、rpcbind软件包(服务端安装)
系统服务:nfs、rpcbind
共享配置文件:/etc/exports
过程:
1、安装nfs-utils、rpcbind软件包
服务端:
添加一个盘,并且配置
挂载到/mnt
yum -y install nfs-utils rpcbind //安装nfs、rpcbind软件包
systemctl enable nfs //nfs自启动
systemctl enable rpcbind //rpcbind自启动
设置共享目录
vim /etc/exports //nfs服务器需要共享给其他客户端服务器的文件夹
/mnt 192.168.154.131/24(rw,sync,no_root_squash) //共享的文件夹
(no_root_squash //防止降级)
systemctl start rpcbind //启动服务
systemctl start nfs //启动服务
netstat -ntap | grep rpc //查看服务是否开启
systemctl stop firewalld.service //关闭防火墙
setenforce //增强性安全功能
showmount -e //查看是否提供出去
客户机:
yum install rpcbind -y //安装rpcbind软件包
systemctl enabled //自启动
yum insatll httpd -y //安装httpd软件包
cd /var/www/html //进入/html文件中
手动挂载
mount 192.168.154.131:/mnt /var/www/html
自动挂载
192.213.32.3:/mnt /var/www/html nfs defaults,_netdev 0 0
vim index.html
cat index.html
systemctl start httpd //开启httpd服务
服务端查看
证明NFS成功,客户端中写入的文档在服务端中能直接搜索到
强制卸载NFS
umount /var/www/html
umount -lf /var/www/html