Ubuntu安裝配置NFS服務

來源:互聯網
上載者:User

   首先確定系統是否安裝了nfs服務,預設的好像沒有。那麼就要安裝咯,不過很簡單的。

一:測試 dpkg -l nfs* 斷行符號,如果有:

caoyi@ubuntu:~$ dpkg -l nfs*

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
un  nfs-client     <none>         (no description available)
ii  nfs-common     1:1.2.2-1ubunt NFS support files common to client and serve
ii  nfs-kernel-ser 1:1.2.2-1ubunt support for NFS kernel server
un  nfs-server     <none>         (no description available)
則表示已經安裝!否則進行下一步:

 

1、安裝NFS
caoyi@ubuntu:~$ sudo apt-get install nfs-kernel-server nfs-common portmap

2.修改NFS設定檔
caoyi@ubuntu:~$ sudo vim /etc/exports
內容為:
     /home/drivers     *(rw,sync,no_root_squash,no_subtree_check)

     /home/lingd/arm---要共用的目錄
      *---允許訪問的網段,也可以是ip地址、主機名稱(能夠被伺服器解析)、*(所有人都能訪問)
     (rw,sync,no_root_squash,no_subtree_check)---rw:讀/寫入權限
                                 sync:資料同步寫入記憶體和硬碟
                                 no_root_squash:伺服器允許遠程系統以root特權存取該目錄
no_subtree_check:關閉子樹檢查
其他選項可以通過man exports查閱man文檔

3、啟動服務
重啟portmapper(連接埠映射)服務
caoyi@ubuntu:~$ sudo service portmap restart
portmap start/running, process 550
重啟NFS服務
caoyi@ubuntu:~$  sudo service nfs-kernel-server restart
 * Stopping NFS kernel daemon                                               [ OK ]
 * Unexporting directories for NFS kernel daemon...                      [ OK ]
 * Exporting directories for NFS kernel daemon...                        [ OK ]
 * Starting NFS kernel daemon                                               [ OK ]

三、測試
1、本機掛載
caoyi@ubuntu:~$  ls /mnt/nfs/
caoyi@ubuntu:~$  sudo mount -t nfs -o nolock localhost:/home/drivers /mnt/nfs/
caoyi@ubuntu:~$  ls /mnt/nfs/

1day  2day 
Makefile_arm

caoyi@ubuntu:~$  sudo umount /mnt/nfs
caoyi@ubuntu:~$  ls /mnt/nfs/

2、開發板掛載
# ls /mnt                                                 
 # mount -t nfs 192.168.7.99:/home/drivers /mnt

192.168.7.99 為宿主機的IP地址

/home/drivers 為在宿主機上   /home/drivers 設定的共用目錄
# cd mnt
# ls
1day          2day          Makefile_arm
#
# umount /mnt
# ls /mnt
#

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.