我有三台机器 –
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/
我已经在上述三台机器中创build了/opt/exhibitor/conf目录。
现在我正试图在所有这三台机器上创build一个安装点。 所以我遵循下面的过程 –
安装NFS支持文件和NFS内核服务器
$ sudo apt-get install nfs-common nfs-kernel-server
创build共享目录
$ 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
现在我已经在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
任何想法我在这里做什么错误?
改变你的/ etc / exports
/opt/exhibitor/conf/ 10.108.24.*(rw)
至
/opt/exhibitor/conf/ 10.108.24.0/24(rw)
好像你正在尝试在同一台服务器上执行NFS挂载
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
MachineA是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/
和machineC上
root@machineC:/# mkdir -p /opt/exhibitor/conf root@machineC:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
你应该能够做到,如果从machineA,但使用不同的目录作为安装点:
root@machineA:/# mkdir -p /opt/exhibitor/conf2 root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf2/
我想你需要在安装时设置用户名和密码。
mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/ -o username=USERNAME,password=PASSWORD
我从来没有尝试nfs,我在我的机器上使用桑巴。 在samba中,我们需要为samba用户添加一个linux用户。
smbpasswd -a username
也许在nfs中也是一样的情况。