NFS服務器實現文件共享


  • NFS服務器運行原理
  • 實戰配置NFS服務器
  • 配置Samba服務器及實現文件共享

       (一)NFS器服務端描述

  1.  NFS服務器: Network File System,網絡文件系統使FreeBSD支持的一種
  2. 系統安裝,直接用yum方式安裝  # yum -y install NFS*
  3. 啟動服務 #/etc/init.d/nfs start    
     啟動顯示失敗:annot register service: RPC: Unable to receive; errno = Connection refused
    rpc.rquotad ,需要啟動rpc服務

  4. # /etc/init.d/nfs start


    Starting NFS services: [ OK ]
    Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
    rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
    [FAILED]
    Starting NFS mountd: [FAILED]
    Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
    rpc.nfsd: unable to set any sockets for nfsd
    [FAILED]  

    # /etc/init.d/rpcbind start
    Starting rpcbind: [ OK ]

       4. 查看NFS服務啟動端口  # netstat -antup | grep 2049

# chkconfig nfs on
# chkconfig --list nfs
nfs                0:off    1:off    2:on    3:on    4:on    5:on    6:off

       5. 設置開機自啟動  

       6. 查看共享目錄

    

# showmount -e 192.168.0.35
Export list for 192.168.0.35:

       7.  設置共享目錄

        編輯 #vim /etc/exports  

     

               /mysh * {rwx}     ### 允許訪問的網段   用戶 權限  ,*表示所有用戶

                                          ### 多網段分開寫

      8.  重啟NFS服務,查看NFS共享,並進行掛載

      

# showmount -e 192.168.0.35
Export list for 192.168.0.35:
/mysh *# mount -t nfs 192.168.0.35:/mysh/ /opt/# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/sda3             19G  5.1G   13G  29% /
tmpfs                427M   72K  427M   1% /dev/shm
/dev/sda1             97M   34M   59M  37% /boot
192.168.0.35:/mysh/  9.5G  1.1G  8.0G  12% /opt

    9.  開機自動掛載 編輯 /etc/fstab 文件,添加即可

   10.權限問題   1)服務本身權限

                       2)目錄權限    # chmod 777 -R /mysh/

     

# grep nfs /etc/passwd
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM