Mark之
安装:
yum -y install nfs-utils rpcbind
nfs服务器配置:
/home/nfs 192.168.150.*(rw,sync,no_root_squash)
/home/nfs 本地路径,可供其他用户访问的
192.168.150.* 此IP下链接的用户才可以访问
(rw,sync,no_root_squash) PS:此处和IP地址没有空格
rw:读写权限
sync:文件同时写入硬盘和内存
no_root_squash:root用户被压缩为nfs server的root用户
启动服务:
service nfs start
如果出现如下错误:
Starting NFS services: [ OK ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]
RH系操作系统在6.0版本之后没有portmap服务控制rpc的启动,由于NFS和nfslock的启动需要向rpc进行注册,rpc不启动的话就会报错。
解决方法:启动rpcbind&rpcidmap rpcbind是6.0版本后默认的RPC服务,所以要先于nfs启动。如果不启动rpcidmap则会造成用户权限的映射错误,用户的权限看起来是一串数字。
[[email protected] ~]# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
[[email protected] ~]# /etc/init.d/rpcidmapd start
Starting RPC idmapd: [ OK ]
[[email protected] ~]# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
引用自:http://www.linuxyw.com/a/yunweiguzhang/20130520/405.html
客户端启动:
/etc/init.d/rpcbind start
挂载
mount -t nfs 192.168.150.130:/home/nfs
非常简单。
参考:http://www.it165.net/admin/html/201405/3177.html