搭建 NFS網路檔案系統(Network File System)

來源:互聯網
上載者:User

標籤:network   應用程式   設定檔   本地磁碟   root許可權   

一、前言:


本地磁碟空間具有局限性。

Linux下如何?“映射網路磁碟機”?

網路存放裝置的共用方式。


1、NFS共用協議


Unix/Linux最基本的檔案分享權限設定機制

:1980年由SUN公司開發。

:依賴於RPC(遠端程序呼叫)映射機制。

:存取位於遠程磁碟中的文檔資料,對應用程式是透明的,就好像訪問本地檔案一樣。


2、配置NFS伺服器

--主要軟體包


  nfs-utils-1.0.9-66.el5

  portmap-4.0-65.2.2.1

--系統服務指令碼

  nfs、portmap

--主要設定檔

  /etc/exports


3、實驗拓撲圖

                                     RHEL5.9_A NFS Server

-------Server1(VM1)---------(VM1) 

      192.168.8.254                 RHEL5.9_B  NFS Client


4、實驗需求


將/root 共用給192.168.8.20,可寫、同步,允許客戶機以root許可權訪問

將/usr/src 共用給192.168.8.0/24網段,可寫、非同步,存取權限均降為nfsnobody使用者


二、配置NFS伺服器


1、安裝軟體包


[[email protected] ~]# rpm -q nfs-utils portmap

nfs-utils-1.0.9-66.el5

portmap-4.0-65.2.2.1                       //兩個軟體包已經安裝


2、修改主設定檔


[[email protected] ~]# vim /etc/exports

[[email protected] ~]# cat /etc/exports

/root   192.168.8.20(rw,sync,no_root_squash)  

//共用目錄    //只開放給192.168.8.20用戶端 可讀寫,同步,保留來自用戶端root許可權

/usr/src     192.168.8.0/24(rw,async,all_squash) 


//共用目錄   //開放給192.168.8.0網段用戶端 可讀寫,非同步,許可權降為nfsnobody

[[email protected] ~]# 


3、啟動服務


[[email protected] ~]# service portmap restart

停止 portmap:                                             [確定]

啟動 portmap:                                             [確定]

[[email protected] ~]# service nfs restart

關閉 NFS mountd:                                          [失敗]

關閉 NFS 守護進程:                                        [失敗]

關閉 NFS quotas:                                          [失敗]

啟動 NFS 服務:                                            [確定]

關掉 NFS 配額:                                            [確定]

啟動 NFS 守護進程:                                        [確定]

啟動 NFS mountd:                                          [確定]

Stopping RPC idmapd:                                       [確定]

正在啟動 RPC idmapd:                                      [確定]

[[email protected] ~]# chkconfig portmap on            //確保服務開機啟動服務

[[email protected] ~]# chkconfig nfs on


4、設定目錄許可權


[[email protected] ~]# setfacl -m u:nfsnobody:rwx /usr/src/



5、用戶端測試


[[email protected] ~]# showmount -e 192.168.8.10

Export list for 192.168.8.10:

/root    192.168.8.20

/usr/src 192.168.8.0/24


掛載並測試寫入 

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/48/38/wKiom1QGkHHBjAjsAAElysJqWEQ582.jpg" title="QQ圖片20140903115106.jpg" alt="wKiom1QGkHHBjAjsAAElysJqWEQ582.jpg" />

本文出自 “學無止境 Crazy Linux” 部落格,請務必保留此出處http://dpzcf.blog.51cto.com/4604404/1548259

搭建 NFS網路檔案系統(Network File System)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.