1. 程式人生 > >linux NFS檔案共享伺服器詳細過程

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/   //檢視伺服器是否有儲存端的檔案