首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

CentOS 5.6创造NFS文件共享服务器

2012-08-11 
CentOS 5.6创建NFS文件共享服务器根据业务需要,在IDC启用一台NFS文件共享服务器。此服务器以后还会被用做文

CentOS 5.6创建NFS文件共享服务器

       根据业务需要,在IDC启用一台NFS文件共享服务器。此服务器以后还会被用做文件备份的存储。便于集中备份管理。由于此文件链接大存储设备。需要对NFS的访问帐号进行统一规划。   首先,确认服务器上是否已安装 nfs,portmap    如未安装,可yum 安装

yum -y install nfs-utilsyum -y install portmap
以下是本机测试的情况NFS SERVER:192.168.1.105NFS Clinet: 192.168.1.106 Server 测试共享目录 /home/shareNFS 的默认帐号 是 nfsnobody[root@localhost ~]#  id nfsnobodyuid=65534(nfsnobody) gid=65534(nfsnobody) groups=65534(nfsnobody) context=root:system_r:unconfined_t:SystemLow-SystemHigh 用此帐号共享云存储的文件将会有错误的。所以还是不要用此帐号,还是用统一用UID为2012的yun帐号Server端的配置[root@localhost ~]# usermod -u 2012 yun[root@localhost ~]# id yunuid=2012(yun) gid=501 groups=501 context=root:system_r:unconfined_t:SystemLow-SystemHigh[root@localhost ~]# usermod -g 2012 yun[root@localhost ~]# id yunuid=2012(yun) gid=2012(yun) groups=2012(yun) context=root:system_r:unconfined_t:SystemLow-SystemHigh[root@localhost ~]# chown yun:yun -R /home/share[root@localhost ~]# vi /etc/exports /home/share 192.168.1.106(rw,sync,anonuid=2012,anongid=2012)[root@localhost ~]# service portmap start启动 portmap:                                             [确定][root@localhost ~]# service nfslock start[root@localhost ~]# service nfs restart关闭 NFS mountd:                                          [确定]关闭 NFS 守护进程:                                        [确定]关闭 NFS quotas:                                          [确定]启动 NFS 服务:                                            [确定]关掉 NFS 配额:                                            [确定]启动 NFS 守护进程:                                        [确定]启动 NFS mountd:                                          [确定]  NFS Client端的配置:    定义在客户端的挂载点。初始定为 /mnt/nfs    
[root@localhost mnt]# chown yun:yun  /mnt/nfs[root@localhost mnt]# chmod 777 /mnt/nfs
[root@localhost mnt]# mount -t nfs -o rw 192.168.1.105:/home/share /mnt/nfs
 即配置成功。
如出现 [root@localhost mnt]# mount -t nfs -o rw 192.168.1.105:/home/share /mnt/nfsmount: mount to NFS server '192.168.1.105' failed: System Error: No route to host.需配置SERVER上的iptables    参考文章  http://www.jcwcn.com/archiver/tid-380349.html 测试在Client下[root@localhost mnt]# cd /mnt/nfs[root@localhost nfs]# ls1.txt[root@localhost nfs]# vi 1.txt[root@localhost nfs]# echo "aaa">2.txt 在server端都可以看到改变,且用户所有者为yun[root@localhost ~]# cat /home/share/1.txthddddello world[root@localhost ~]# ll /home/share总计 16-rw-r--r-- 1 yun yun 16 07-15 01:40 1.txt-rw-r--r-- 1 yun yun  4 07-15 01:40 2.txt
经过测试,发现文件读写,文件权限都正确。


NFS服务器端添加自动启动设置nfs、portmap开机自启动: chkconfig --add nfschkconfig --add portmapchkconfig --level 345 nfs onchkconfig --level 345 portmap on  客户端需要启动portmap 服务chkconfig --add portmapchkconfig --level 345 portmap on客户端需添加自动挂载vim /etc/fstab /dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1LABEL=/boot             /boot                   ext3    defaults        1 2tmpfs                   /dev/shm                tmpfs   defaults        0 0devpts                  /dev/pts                devpts  gid=5,mode=620  0 0sysfs                   /sys                    sysfs   defaults        0 0proc                    /proc                   proc    defaults        0 0/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0192.168.1.105:/home/share /mnt/nfs             nfs       defaults    0 0 

--完 --

热点排行