linux 建立NFS服務

2021-07-04 19:13:59 字數 2331 閱讀 1579

一、環境介紹

nfs伺服器:centos6.5 192.168.0.10

nfs客戶端:centos6.5 192.168.0.11

二、伺服器端安裝配置

1、先用rpm -qa命令檢視所需安裝包(nfs-utils、rpcbind)是否已經安裝:

1.[root@local /]# rpm -qa | grep "rpcbind"

rpcbind-0.2.0-11.el6.x86_64

2.[root@local /]# rpm -qa | grep "nfs"

nfs-utils-1.2.3-39.el6.x86_64

nfs4-acl-tools-0.3.3-6.el6.x86_64

nfs-utils-lib-1.1.5-6.el6.x86_64

2、如查詢結果如上,說明伺服器自身已經安裝了nfs,如果沒有安裝,則用yum命令來安裝:

1.[root@local /]# yum -y install nfs-utils rpcbind

3、建立共享目錄:

1.[root@local /]# mkdir /sharestore

2./sharestore     *(rw,sync,no_root_squash)

5、啟動nfs服務(先啟動rpcbind,再啟動nfs;如果伺服器自身已經安裝過nfs,那就用restart重啟兩個服務):

1.[root@local /]# service rpcbind restart

starting rpcbind:                                          [  ok  ]

2.[root@local /]# service nfs restart

starting nfs services:                                     [  ok  ]

starting nfs quotas:                                       [  ok  ]

starting nfs mountd:                                       [  ok  ]

stopping rpc idmapd:                                       [  ok  ]

starting rpc idmapd:                                       [  ok  ]

starting nfs daemon:                                       [  ok  ]

[root@local /]#

note:這裡一定要先輸入service portmap restart(fedora 10以上為service rpcbind restart)再輸入

service nfs restart,因為只有埠開了再開啟nfs服務才可以找到埠。

6、設定nfs服務開機自啟動:

1.[root@local /]# chkconfig rpcbind on

2.[root@local /]# chkconfig nfs on

三、客戶端掛載配置

1、建立乙個掛載點:

1.[root@localhost ~]# mkdir /mnt/store

2、檢視nfs伺服器上的共享:

1.[root@localhost /]# showmount -e 192.168.0.10

export list for 192.168.0.10:

/sharestore *

3、掛載:

1.[root@localhost ~]# mount -t nfs -o nolock 192.168.0.10:/sharestore /mnt/store

例如:mount -t nfs -o nolock 192.168.168.52:/mnt/share /home/miko

如果服務端反覆掛載不上,請檢查防火牆狀態,關閉防火牆

1) 永久性生效,重啟後不會復原

開啟: chkconfig iptables on

關閉: chkconfig iptables off

2) 即時生效,重啟後復原

開啟: service iptables start

關閉: service iptables stop

查詢tcp連線情況:

netstat -n | awk '/^tcp/ end '

查詢埠占用情況:

netstat   -anp   |   grep  portno(例如:netstat –apn | grep 80)

MACOS 如何建立NFS服務

sudo vi etc exports volumes data alldirs mapall 501 network 192.168.0.0 mask 255.255.254.0其中 volumes data 要共享的本機目錄 alldirs掛載該目錄下的所有子目錄 mapall 501 使用使用...

linux檔案服務 NFS

系統 centos linux release 7.9.2009 core 核心 3.10.0 1160.11.1.el7.x86 64 簡介 nfs network file system 網路檔案系統,linux unix系統之間共享檔案的一種協議 支援多點同時掛載和併發寫入 提供檔案共享服務,...

Linux 檔案服務NFS服務 詳解

名詞管理 nfsnetwork file system網路檔案系統,linux unix系統之間共享檔案的一種協議 nfs的客戶端主要為linux 支援多節點同時掛載,以及併發寫入 nfs作用 提供檔案共享服務 為web server配置集群中的後端儲存 使用環境 關閉防火牆 vim etc sel...