参考资料:
http://fedorasolved.org/post-install-solutions/nfsv4-fedora
一、准备的软件包
server :
Client':
二、server的配置
1.开防火墙端口
nfs是2049 setup里是NF4
portmap是111
2.配置nfs的/etc/idmapd.conf
[General]
Domain = example.com
[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
3.启动nfs nfslock(portmap)服务
#su -c "/sbin/service portmap start"
su -c "/sbin/service nfslock start"
su -c "/sbin/service nfs start"
#su -c "/sbin/chkconfig --level 345 portmap on"
su -c "/sbin/chkconfig --level 345 nfslock on"
su -c "/sbin/chkconfig --level 345 nfs on"
4.配置nfs的分区等
su -c "mkdir -p /nfs4exports/{share1,share2,share3}"
5.修改/etc/fstab
/path/to/share1 /nfs4exports/share1 none bind 0 0
/path/to/share2 /nfs4exports/share2 none bind 0 0
/path/to/share3 /nfs4exports/share3 none bind 0 0
然后mount -a
6.修改/etc/exports
这是对192.168.1.0开发 读写,如果是只读,就把rw改为ro
/nfs4exports 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide,fsid=0)
/nfs4exports/share1 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
/nfs4exports/share2 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
/nfs4exports/share3 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
然后 重启服务
su -c "exportfs -rv"
7,有可能还得需要修改
/etc/hosts.allow
三、客户端的配置
1.修改 /etc/idmapd.conf
[General]
Domain = example.com
[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
2.建立挂载目录
su -c "mkdir /mnt/shares /home/me/share1 /home/he/share2 /home/it/share3"
3.修改/etc/fstab
192.168.1.3:/usr/local/nfs /mnt/shares nfs4 rsize=8192,wsize=8192,timeo=14,intr
<ip-address-to-server>:/ /home/me/share1 nfs4 rsize=8192,wsize=8192,timeo=14,intr
<ip-address-to-server>:/ /home/he/share2 nfs4 rsize=8192,wsize=8192,timeo=14,intr
<ip-address-to-server>:/ /home/it/share3 nfs4 rsize=8192,wsize=8192,timeo=14,intr
然后mount -a
ps:修改完/etc/idmapd.conf, 之后需要运行service rpcidmapd restart