linux NFS文件共享服务器详细过程

sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config和进去修改配置文件一样    //开机关闭防火墙
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
vim /etc/hosts    //做域名解析
###nas存储端
yum -y install nfs-utils        //下载软件
mkdir /webdata      //创建共享文件的文件夹cd进去写文件
vim /etc/exports  里面修改配置文件//上面创建的文件夹 172.16.22.0/24(rw,sync,no_root_squash)    //不压制root(当client端使用root挂载时,也有root权限)
开机自启服务
systemctl start nfs-server && systemctl enable nfs-server
exportfs -v
###web1 web2 web3 客户端
yum -y install nfs-utils httpd        //下载服务
开机自启服务
systemctl start httpd
systemctl enable httpd
showmount -e 解析的存储端名称        //查看存储端共享
vim /etc/fstab        //自动挂载到网站主目录
添加解析的存储端名称:/文件夹名称      /var/www/html           nfs     defaults        0 0
mount -a
df        //查看挂载
ls /var/www/html/   //查看服务器是否有存储端的文件

猜你喜欢

转载自blog.csdn.net/tiger199/article/details/81182592