NFS是Net File System的簡寫,即網絡檔案系統.
網絡檔案系統是FreeBSD支援的檔案系統中的一種,也被稱為NFS. NFS允許一個系統在網絡上與它人共享目錄和檔案。通過使用NFS,使用者和程式可以象通路本地檔案一樣通路遠端系統上的檔案。
我的系統為ubuntu9.04,配置NFS時遇到了些問題,不過最後還是解決了。謝謝hi.baidu.com/leoxeon/blog/item/e59d4644fc8e8e48500ffe4e.html的文章幫我解決了最後的一個錯誤。
安裝nfs-kernerl-server
creek@creek-laptop:~$ sudo apt-get install nfs-kernel-server這時順帶着也會安裝上nfs-common
添加共享目錄
creek@creek-laptop:~$ sudo gedit /etc/exports
在其中添加如下行:
/home/creek/nfs *(rw,sync,no_subtree_check)
在我的使用者目錄下建立目錄
creek@creek-laptop:~$mkdir nfs
修改操作權限
creek@creek-laptop:~$chmod 777 -R nfs
然後按照查到的資料上輸入以下指令
creek@creek-laptop:/etc$ init.d/nfs-kernel-server start
* Exporting directories for NFS kernel daemon...
exportfs: could not open /var/lib/nfs/etab for locking
exportfs: can't lock /var/lib/nfs/etab for writing
[ OK ]
* Starting NFS kernel daemon [fail]
按照提示修改 /var/lib/nfs/etab權限
creek@creek-laptop:~$chmod 777 -R /var/lib/nfs/etab
再試
exportfs: can't open /var/lib/nfs/etab.tmp for writing
發現沒有/var/lib/nfs/etab.tmp這個檔案,而且/var/lib/nfs對非建立使用者是不可寫的,于是
creek@creek-laptop:~$chmod 777 -R /var/lib/nfs
又試
* Exporting directories for NFS kernel daemon... [ OK ]
沒有提示錯誤了,可是依舊不能啟動NFS服務,restart nfs 得到這樣的結果
creek@creek-laptop:/etc$ init.d/nfs-kernel-server restart
* Stopping NFS kernel daemon [ OK ]
* Unexporting directories for NFS kernel daemon... [ OK ]
後來在上面的部落格中找到答案
creek@creek-laptop:~$ sudo /etc/init.d/portmap start
* Starting portmap daemon...
* Already running. [ OK ]
creek@creek-laptop:~$ sudo /etc/init.d/nfs-common start
* Starting NFS common utilities [ OK ]
creek@creek-laptop:~$ sudo /etc/init.d/nfs-kernel-server start
* Starting NFS kernel daemon [ OK ]
最後NFS成功啟動。