How to setup NFS in Ubuntu
- install nfs
$sudo apt-get install nfs-kernel-server |
- check hosts name
$hostname
--fqdn
ex:
$hostname
--fqdn
usernamehost |
The host name could not have special
character, like "-, _, ", only "usernamehost".
if return error, modify the host name, log-out then log-in.
$sudo
vim /etc/hosts
127.0.1.1
kelseylaiAS5551
…
…. |
- setup nfs
$vim
/etc/hosts.allow
portmap:
[tv_ip]
lockd:
[tv_ip]
rquotad:
[tv_ip]
mountd:
[tv_ip]
statd:
[tv_ip]
ex:
$sudo
vim /etc/hosts.allow
...
portmap:
192.168.0.107
lockd:
192.168.0.107
rquotad:
192.168.0.107
mountd:
192.168.0.107
statd:
192.168.0.107
… |
/etc/hosts.deny
和
/etc/hosts.allow
設定對portmap的訪問.
採用這兩個配置檔案有點類似黑名單,白名單的意思.
先在/etc/hosts.deny中禁止所有用
戶對portmap的訪問.再在/etc/hosts.allow
中允許某些特殊用戶對portmap的訪問。
- modify NFS directory permission
$sudo
vim /etc/exports
…
/home/NFS
192.168.0.*(rw,sync,no_root_squash)
…
|
NFS掛載目錄及權限由/etc/exports檔案定義
例如,我在家目錄下建立一個名為NFS的目錄,作為共享給板子的,則在該檔案裡加入
/home/NFS/192.168.0.*(rw,sync,no_root_squash)
- make direcotry for NFS
$mkdir
[you_want_nfs_path]
ex:
$sudo mkdir /home/NFS |
$sudo service nfs-kernel-server restart |