NFS服务器端设置

[root@rhel5 ~]#mkdir /mnt/cdrom

[root@rhel5 ~]#mount /dev/cdrom /mnt/cdrom

wps_clip_image-18539

[root@rhel5 Server]# rpm -ivh nfs-utils-1.0.9-42.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh nfs-utils-lib-1.0.8-7.6.el5.i386.rpm  //需要安装的三个包

wps_clip_image-1711

[root@rhel5 Server]# rpm -ql nfs-utils |less

wps_clip_image-27700

Nfs 的配置文件是/etc/exports   我们来编辑一下

wps_clip_image-164

[root@rhel5 ~]# mkdir /share //建立共享目录

[root@rhel5 ~]# echo "i am share" >/share/share1.txt  //创建文件

[root@rhel5 /]# ll -d share //查看共享目录的详细

drwxr-xr-x 2 root root 4096 Apr 15 08:23 share

[root@rhel5 /]# chmod o+w share  //把共享目录other用户的本地权限更改为可写

NFS客户端设置
1. 手动、开机自动挂载

[root@mail ~]# mkdir /mnt/share //在nfs客户端上建立nfs共享目录挂载点

//实现手工挂载

wps_clip_image-17035

//切换到共享目录下,查看和创建文件

wps_clip_image-21665

//nfs的配置文件改为下面的方式,实现权限限制

wps_clip_image-22186

//加入开机自动挂载(有两种方法)

方法1:加入开机启动项

wps_clip_image-10398

//重新执行开机启动项

wps_clip_image-26570

方法2:默认开机自动挂载项添加 (/etc/fstab)

wps_clip_image-5022

//重新加载系统默认的挂载项

wps_clip_image-31430

2. nfs远程自动挂载、卸载的实现

//实现需要安装的包

wps_clip_image-20823

[root@mail Server]# rpm -ivh autofs-5.0.1-0.rc2.131.el5.i386.rpm  //安装

//autofs的配置文件是/etc/auto.master,编辑配置文件

wps_clip_image-1463

[root@mail ~]# cp /etc/auto.misc /etc/auto.nfs //创建配置文件所需的auto.nfs文件,并编辑

wps_clip_image-27595

//所有的配置做好之后启动服务(service autofs start),往往会出现之前的挂载不能卸载,解决方法如下图

wps_clip_image-28069

//nfs自动挂载、卸载测试如下面两幅图

wps_clip_image-21192wps_clip_image-3708