Ubuntu 14.04配置nfs服务

网上许多nfs的配置说明所使用ubuntu版本过老或者存在其他问题

本文使用ubuntu14.04 默认安装了rpcbing

1. 下载nfs套件
apt-get install nfs-kernel-server nfs-clinet nfs-common


2. 开启相关服务(ubuntu)
service portmap start


3. nfs服务端配置
vi /etc/exports
<共享文件名>  <hostname1/IP1(参数)> <hostname2/IP2(参数)> ...
eg: /home/user/shared *(rw,sync,no_root_squash)
    向所有网段共享/home/user/shared文件或文件夹,参数:读写、同步、非root权限


详细配置内容见该blog
http://blog.chinaunix.net/uid-20628575-id-72545.html


4. 开启nfs server服务
service nfs-kernel-server start


5. 客户端查看共享文件
showmount -e 192.168.1.100
(假设服务端IP为:192.168.1.100)
显示:Export list for 192.168.1.100:
/home/user/shared *


6. 客户端挂载共享文件
mount -t nfs 192.168.1.100:/home/user/shared /home/user/new_folder


完成文件共享!


FAQ:
配置过程中可能出现以下问题
1. 开启portmap过程中出现unrecognized service portmap ....
portmap软件不存在,可能在ubuntu高版本中替换为rpcbind,无需开启该服务
2. 客户端showmount看不到共享文件
确认双方处于同一局域网下
3. 客户端挂载共享文件时出现mount.nfs: access denied by server while mounting 192.168.1.108:/home/user/shared
可能原因1: 服务端允许访问网段设置错误
可能原因2: 服务端参数设置为root_squash(root权限访问)
可能原因3: 共享文件名存在大写,nfs服务对大小写不敏感无法识别

猜你喜欢

转载自blog.csdn.net/u013212391/article/details/50893671
今日推荐