1. 程式人生 > >Linux檔案共享服務之NFS

Linux檔案共享服務之NFS

NFS(Network File System)網路檔案系統,主要用於LInux與Linux之間進行檔案系統共享的服務,依賴於RPC服務(遠端呼叫)。 伺服器端需要安裝的軟體包:nfs-utils   、 rpcbind 客服端需要安裝的軟體包:rpcbind

NFS檔案共享服務的搭建:

伺服器端 (Rhel7      ip: 192.168.10.17) 客戶端 (Centos 6.5 ip: 192.168.110.24)

  1. 伺服器端安裝相應的軟體包:  yum  -y  install  rpcbind  nfs-utils
  2. 伺服器端關閉SElinux和防火牆:setenforce  0  ; systemctl  stop  firewalld 
  3. 建立共享目錄,並且賦予許可權:mkdir  /share  ;    chmod   777    /share
  4. 修改共享配置檔案 /etc/exports ,然後重新載入exports檔案:expotfs  -a
  5. 啟動 rpcbind服務和nfs服務: systemctl  start  rpcbind ; systemctl  start  nfs
  6. 客戶端關閉Selinux和防火牆:setenforce  0  ; service  iptables  stop
  7. 客戶端安裝rpcbind,並且啟動:  yum  -y  install  recbind  ;  service   rpcbind  start 
  8. 建立掛載點,檢視,並且掛載:mkdir  /data ;  showmount  -e  192.168.10.17;  mount  -t nfs  192.168.10.17:/share  /data

1:伺服器端安裝相應的軟體包:  yum  -y  install  rpcbind  nfs-utils

2: 伺服器端關閉SElinux和防火牆:setenforce  0  ; systemctl  stop  firewalld

3: 建立共享目錄,並且賦予許可權:mkdir  /share  ;    chmod   777    /share 

4:修改共享配置檔案 /etc/exports ,然後重新載入exports檔案:expotfs  -a 

/share  192.168.10.0/24(rw,sync,no_root_squash)

5:systemctl  start  rpcbind ; systemctl  start  nfs

6:客戶端關閉SElinux和防火牆:setenforce  0  ; service  iptables  stop

7:客戶端安裝rpcbind,並且啟動:  yum  -y  install  recbind  ;  service  rpcbind  start

8:建立掛載點,檢視,並且掛載:mkdir  /data ;  showmount  -e  192.168.10.17;  mount  -t nfs  192.168.10.17:/share   /data

注:這裡我已經在客戶端的hosts檔案中添加了Redhat解析192.168.10.17