CentOS 5.6创建NFS文件共享服务器
根据业务需要,在IDC启用一台NFS文件共享服务器。此服务器以后还会被用做文件备份的存储。便于集中备份管理。由于此文件链接大存储设备。需要对NFS的访问帐号进行统一规划。 首先,确认服务器上是否已安装 nfs,portmap 如未安装,可yum 安装
以下是本机测试的情况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/nfsyum -y install nfs-utilsyum -y install portmap
[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即配置成功。