溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

nfs網(wǎng)絡文件系統(tǒng)如何安裝

發(fā)布時間:2021-11-16 10:42:33 來源:億速云 閱讀:175 作者:小新 欄目:云計算

這篇文章給大家分享的是有關nfs網(wǎng)絡文件系統(tǒng)如何安裝的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

一:nfs服務器端的安裝

  • 1、安裝nfs服務

      yum -y install nfs-utils


  • 2、配置發(fā)布的路徑及訪問權限

      vim /etc/exports             增加
      /nfsPrimary *(rw,async,no_root_squash,no_subtree_check)
      /nfsSecondary *(rw,async,no_root_squash,no_subtree_check)


    同時可以指定誰能夠掛在這個共享出去的文件夾

      /nfsPrimary liufukinKVM(rw,async,no_root_squash,no_subtree_check)
      /nfsSecondary 192.168.10.*(rw,async,no_root_squash,no_subtree_check)


  • 3、配置nfs需要綁定的端口

      vim /etc/sysconfig/nfs


    找到下面的配置項,并且開啟

      LOCKD_TCPPORT=32803
      LOCKD_UDPPORT=32769
      MOUNTD_PORT=892
      RQUOTAD_PORT=875
      STATD_PORT=662
      STATD_OUTGOING_PORT=2020


  • 4、iptables防洪墻開放端口(要在reject之前增加,否則無效)

    vi /etc/sysconfig/iptables

      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT
      -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPT


    防火墻重啟

      service iptables restart


  • 5、關閉selinux或者開啟允許模式

      sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
      setenforce 0


  • 6、啟動nfs服務器

      service rpcbind start
      service nfs start
      chkconfig rpcbind on
      chkconfig nfs on


二、NFS客戶端的操作

  • 1、showmout命令對于NFS的操作和查錯有很大的幫助,所以我們先來看一下showmount的用法

      showmout 
      -a :這個參數(shù)是一般在NFS SERVER上使用,是用來顯示已經(jīng)mount上本機nfs目錄的cline機器。 
      -e :顯示指定的NFS SERVER上export出來的目錄。


    例如:

      showmount -e 192.168.0.30 
      Export list for localhost: 
      /tmp * 
      /home/linux *.linux.org 
      /home/public (everyone) 
      /home/test 192.168.0.100


  • 2、mount nfs目錄的方法:

      mount -t nfs hostname(orIP):/directory /mount/point


    具體例子:

      Linux: mount -t nfs 192.168.0.1:/tmp /mnt/nfs 
      [root[@localhost](https://my.oschina.net/u/570656) /]# showmount -e 192.168.0.169
      Export list for 192.168.0.169:
      /home/opt/RHEL4U5 192.168.0.0/255.255.252.0
      You have new mail in /var/spool/mail/root
      mount -t nfs 192.168.0.169:/home/opt/RHEL4U5 /mnt/soft


    注意:需要安裝nfs,否則會報

      mount: wrong fs type, bad option, bad superblock on 125.64.41.244:/data/img,
      missing codepage or helper program, or other error
      (for several filesystems (e.g. nfs, cifs) you might
      need a /sbin/mount.<type> helper program)
      In some cases useful info is found in syslog - try
      dmesg | tail  or so


感謝各位的閱讀!關于“nfs網(wǎng)絡文件系統(tǒng)如何安裝”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

nfs
AI