您的位置:首页 > 运维架构 > Linux

CentOS release 5.11 (Final)配置NFS服务过程

2015-07-09 17:31 393 查看
今天使用CentOS release 5.11 (Final),内核版本2.6.18-406.el5配置NFS服务,用WIN7做客户端;过程如下:
1、查看是否安装portmap和nfs:
[root@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注册端口:
[root@localhost test]# /etc/init.d/portmap start
Starting portmap: [ OK ]
[root@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 65534 nfsnobody
groupmod -g 65534 nfsnobody
usermod -g 65534 nfsnobody

[root@localhost ~]# cat /var/lib/nfs/etab中anonuid=2147483647,anongid=2147483647在此范围之内,
超过均无法写入;

4、向exports写入配置如:
[root@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=65534,anongid=65534)

5、重启服务:
[root@localhost test]# /etc/init.d/nfs reload

6、更改权限:
[root@localhost test]# chown -R nfsnobody /test/
[root@localhost test]# ls -ld /test/
drwxr-xr-x 5 nfsnobody 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

命令已成功完成。

至此完成。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: