|
今天使用CentOS release 5.11 (Final),内核版本2.6.18-406.el5配置NFS服务,用WIN7做客户端;过程如下:1、查看是否安装portmap和nfs:
[iyunv@localhost test]# rpm -qa|egrep "nfs|portmap"
nfs-utils-1.0.9-71.el5_11
portmap-4.0-65.2.2.1
nfs-utils-lib-1.0.8-7.9.el5
system-config-nfs-1.3.23-2.el5
如果没有安装使用:yum -y install nfs portmap
2、必须先启动portmap,然后再启动nfs启动服务,因为nfs向portmap注册端口:
[iyunv@localhost test]# /etc/init.d/portmap start
Starting portmap: [ OK ]
[iyunv@localhost test]# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
3、设置nfsnobody的UID,GID,防止后续权限问题:
usermod -u 4294967294 nfsnobody
groupmod -g 4294967294 nfsnobody
usermod -g 4294967294 nfsnobody
4、向exports写入配置如:
[iyunv@localhost test]# vi /etc/exports
#/test 192.168.1.0/24(rw,sync)
#32bit 系统
#/test 192.168.1.0/24(rw,sync,all_squash)
#64bit 5.x 系统
/test 192.168.1.0/24(rw,sync,all_squash,anonuid=4294967294,anongid=4294967294)
#指定UID,GID
为什么要指定anonuid=4294967294,anongid=4294967294;因为使用win7做客户端挂着时创建文件产生的UID,GID是这个;
5、重启服务:
[iyunv@localhost test]# /etc/init.d/nfs reload
6、更改权限:
[iyunv@localhost test]# chown -R nobody /test/
[iyunv@localhost test]# ls -ld /test/
drw-r-xr-x 5 nobody root 4096 Jul 9 15:55 /test/
7、配置客户端win7:
控制面板\所有控制面板项\程序和功能
打开或关闭windows功能
开启NFS服务
在CMD下
C:\>showmount -a 192.168.1.1
所有装入点在 192.168.1.1:
C:\>showmount -e 192.168.1.1
导出列表在 192.168.1.1:
/test 192.168.1.0/24
C:\>mount \\192.168.1.1\test H:
H: 现已成功连接到 \\192.168.1.1\test
命令已成功完成。
至此完成。
|
|