我有三台機器 -
machineA 10.108.24.132
machineB 10.108.24.133
machineC 10.108.24.134
所有這些機器都安裝了 Ubuntu 12.04,並且我對這三台機器都有 root 存取權。
現在我應該在我的上面的機器上做以下事情 -
Create mount point /opt/exhibitor/conf
Mount the directory in all servers.
sudo mount <NFS-SERVER>:/opt/exhibitor/conf /opt/exhibitor/conf/
/opt/exhibitor/conf
如上所述,我已經在所有這三台機器中建立了目錄。
現在我試圖在所有這三台機器上建立一個掛載點。所以我遵循了以下過程 -
安裝 NFS 支援檔案和 NFS 核心伺服器
$ sudo apt-get install nfs-common nfs-kernel-server
建立共享目錄
$ mkdir /opt/exhibitor/conf/
編輯 /etc/exports 並新增以下條目:
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/opt/exhibitor/conf/ 10.108.24.*(rw)
運行exportfs
root@machineA:/# exportfs -rv
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "10.108.24.*:/opt/exhibitor/conf/".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
exporting 10.108.24.*:/opt/exhibitor/conf
現在我做showmount
了machineA
root@machineA:/# showmount -e 10.108.24.132
Export list for 10.108.24.132:
/opt/exhibitor/conf 10.108.24.*
現在當我這樣做時,我收到一個錯誤 -
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
mount.nfs: access denied by server while mounting 10.108.24.132:/opt/exhibitor/conf
知道我在這裡做錯了什麼嗎?
答案1
更改您的 /etc/exports
/opt/exhibitor/conf/ 10.108.24.*(rw)
到
/opt/exhibitor/conf/ 10.108.24.0/24(rw)
答案2
看起來您正在嘗試在同一台伺服器上進行 NFS 掛載
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
機器A是10.108.24.132
你試過了嗎?
root@machineB:/# mkdir -p /opt/exhibitor/conf
root@machineB:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
在機器C上
root@machineC:/# mkdir -p /opt/exhibitor/conf
root@machineC:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
您應該能夠從 machineA 執行 if 但使用不同的目錄作為安裝點:
root@machineA:/# mkdir -p /opt/exhibitor/conf2
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf2/
答案3
之前,我很抱歉我的英語很糟糕。但我會盡力寫得更好。
我認為您需要在安裝時設定使用者名稱和密碼。
mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/ -o username=USERNAME,password=PASSWORD
我從來沒有嘗試過 nfs,我在我的機器上使用 samba。在samba中,我們需要將linux用戶加入samba用戶。
smbpasswd -a username
也許nfs中也是同樣的情況。