nfs 搭建

Centos 6.3

[root@localhost ~]# yum install nfs-utils-*

[root@localhost ~]# yum install rpcbind //centos5里边是portmap

NFS服务的配置文件为 /etc/exports,这个文件是NFS的主要配置文件,不过系统并没有默认值,所以这个文件不一定会存在,可能要使用vim手动建立,然后在文件里面写入配置内容

/etc/exports文件内容格式:

<输出目录> [客户端1 选项(访问权限,用户映射,其他)] [客户端2 选项(访问权限,用户映射,其他)]

a. 输出目录:

输出目录是指NFS系统中需要共享给客户机使用的目录;

b. 客户端:

客户端是指网络中可以访问这个NFS输出目录的计算机

客户端常用的指定方式

指定ip地址的主机:192.168.0.200
指定子网中的所有主机:192.168.0.0/24 192.168.0.0/255.255.255.0
指定域名的主机:david.bsmart.cn
指定域中的所有主机:*.bsmart.cn
所有主机:*
c. 选项:

选项用来设置输出目录的访问权限、用户映射等。

NFS主要有3类选项:

访问权限选项

设置输出目录只读:ro
设置输出目录读写:rw

[root@localhost ~]# service rpcbind start

[root@localhost ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]

[root@localhost ~]# ps aux|grep nfs
root 32717 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd4]
root 32718 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd4_callbacks]
root 32719 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32720 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32721 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32722 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32723 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32724 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32725 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32726 0.0 0.0 0 0 ? S 09:57 0:00 [nfsd]
root 32728 0.0 0.0 103156 832 pts/0 S+ 09:57 0:00 grep nfs

mount -t nfs 192.168.0.8:/data/webdata  /web/webdata

posted @ 2013-10-22 17:14  kingtigerhu  阅读(168)  评论(0编辑  收藏  举报