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/

  

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