NFS配置
(在安装Linux Centos 的时候,通常都会配置安装到 NFS服务)
1、环境介绍:
服务器:centos 192.168.70.129
客户端:centos 192.168.70.130
2、NFS配置
vi /etc/exports 加入容许被其余计算机访问的目录和访问权限
如: /home/wwwroot 192.168.70.130(rw,sync,no_root_squash) 这些地址能够访问/home/wwwroot,()内表示权限限制
ro/rw: 只读/可读可写
sync:同步写磁盘(容许修改)
no_root_squash:表示客户端root用户对该目录具备写权限
通常只改目录和IP,权限部分不作修改
3、使用NFS
一、当编辑完配置文件/etc/exports后,就该启动NFS服务了。启动方法为:
二、[root
@localhost ~]# service portmap start; service nfs start (在服务器终端,启动NFS服务进程)
NFS是依托portmap的,因此首先要启动portmap,而后启动NFS才能是刚才的配置生效。启动完NFS后,就该使用NFS服务了。
三、[root
@localhost ~]# showmount -e 192.168.70.129 (在客户服务器终端;192.168.70.129 为服务器IP地址)
Export list for 192.168.70.129:
/home/wwwroot 192.168.70.130
四、[root
@localhost wwwroot]# mount -t nfs 192.168.70.129:/home/wwwroot /home/wwwroot (在客户端挂载-> 将服务器端的 /home/wwwroot 挂载到 客户端 的 /home/wwwroot 目录下)
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.70.129:/home/wwwroot on /home/wwwroot type nfs (rw,addr=192.168.70.129)
4、解除挂载:
[root
@localhost ~]# umount /home/wwwroot
[root
@localhost ~]# mount