Linux NFS安装

NFS配置的一些选项说明

rw 读写

ro 只读

sync 同步模式,内存中数据时时写入硬盘

async 不同步,把内存数据定期写入硬盘中

no_root_squash 加上这个选项后,root用户就会对共享目录拥有至高的权限,就像对本机的目录操作一样,不安全,不建议使用

root_squash 和上面的选项对应,root用户对共享目录权限不高,只有普通用户的权限,即限制了root

all_squash 不管使用NFS的用户是谁,他的身份都会限定成为一个指定的普通用户身份

anonuid/anongid 要和root_squash及all_squash一同使用,用于指定使用NFS的用户限定后的uid gid前提是本机的/etc/passwd中存在这个uid gid

NFS服务端

   1.打印系统版本

   [root@nfsserver ~]#cat /etc/redhat-release
   [root@nfsserver ~]#uname -r

   2.检查并安装NFS服务

   [root@nfsserver ~]# rpm -qa rpcbind portmap nfs

   [root@nfsserver ~]#yum groupinstall "NFS file server"或者yum install -y nfs-utils rpcbind

   3.启动RPC及NFS服务并检查

   [root@nfsserver ~]#/etc/init.d/rpcbind start

   [root@nfsserver ~]# ps -ef |grep rpc
   [root@nfsserver ~]#/etc/init.d/rpcbind status

   [root@nfsserver ~]#rpcinfo -p localhost

   4.设置开机自动启动并检查

   [root@nfsserver ~]#  chkconfig nfs on
   [root@nfsserver ~]# chkconfig rpcbind on

   5.配置共享data目录

   [root@nfsserver ~]# vim /etc/exports
##########shared data for bbs by andy at 20160825
/data            192.168.100.0/24(rw,sync)

   6.创建共享目录

   [root@nfsserver ~]# mkdir /data

   7.平滑加载NFS服务并检查服务

   [root@nfsserver ~]#/etc/init.d/nfs reload

   [root@nfsserver ~]#showmount -e localhost

NFS客户端

   1.检查系统版本

    [root@nfsclient ~]# cat /etc/redhat-release
    CentOS release 6.5 (Final)
    [root@nfsclient ~]# uname -r
    2.6.32-431.el6.x86_64   

   2.安装rpc服务并检查

    [root@nfsclient ~]# yum groupinstall "NFS file server"

   3.启动rpc服务并检查

    [root@nfsclient ~]#/etc/init.d/rpcbind start

   4.设置开机自动启动并检查

    [root@nfsclient ~]#chkconfig rpcbind on

   5.检查服务端NFS是否OK

    [root@nfsclient ~]#showmount -e 服务的ip地址

   6.挂载并测试

    [root@nfsclient ~]#mount -t nfs 192.168.100.100:/data /mnt/

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章