新聞中心
CentOS NFS(網(wǎng)絡(luò)文件系統(tǒng))是一種在分布式計(jì)算環(huán)境中實(shí)現(xiàn)文件共享的協(xié)議,通過使用NFS,可以在不同的計(jì)算機(jī)之間共享文件和目錄,從而實(shí)現(xiàn)數(shù)據(jù)和資源的高效利用,本文將介紹如何在CentOS 7上安裝和配置NFS服務(wù)。

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了陽原免費(fèi)建站歡迎大家使用!
一、安裝NFS服務(wù)
1. 確保系統(tǒng)已經(jīng)更新到最新版本,在終端中輸入以下命令:
sudo yum update
2. 安裝NFS服務(wù)所需的軟件包,在終端中輸入以下命令:
sudo yum install nfs-utils
3. 啟動(dòng)并設(shè)置NFS服務(wù)開機(jī)自啟,在終端中輸入以下命令:
sudo systemctl start nfs-server sudo systemctl enable nfs-server
4. 查看NFS服務(wù)狀態(tài),在終端中輸入以下命令:
sudo systemctl status nfs-server
二、配置NFS共享目錄
1. 創(chuàng)建一個(gè)用于共享的目錄,創(chuàng)建一個(gè)名為“/shared”的目錄:
sudo mkdir /shared
2. 設(shè)置該目錄的權(quán)限,以便其他用戶可以訪問和修改,設(shè)置為所有用戶可讀寫:
sudo chmod 777 /shared
3. 在客戶端計(jì)算機(jī)上創(chuàng)建一個(gè)掛載點(diǎn),用于訪問共享目錄,創(chuàng)建一個(gè)名為“/mnt/nfs”的目錄:
sudo mkdir /mnt/nfs
4. 將遠(yuǎn)程服務(wù)器上的共享目錄掛載到客戶端計(jì)算機(jī)上,假設(shè)遠(yuǎn)程服務(wù)器的IP地址為“192.168.1.100”,則執(zhí)行以下命令:
sudo mount -t nfs 192.168.1.100:/shared /mnt/nfs
5. 若要使掛載在系統(tǒng)啟動(dòng)時(shí)自動(dòng)生效,需要編輯“/etc/fstab”文件,備份文件:
sudo cp /etc/fstab /etc/fstab.bak
使用文本編輯器打開“/etc/fstab”文件,例如使用“vi”編輯器:
sudo vi /etc/fstab
在文件末尾添加以下行,其中“192.168.1.100”是遠(yuǎn)程服務(wù)器的IP地址,“/shared”是共享目錄的路徑:“192.168.1.100:/shared /mnt/nfs nfs defaults 0 0”
保存并關(guān)閉文件,執(zhí)行以下命令使更改生效:
sudo mount -a
三、驗(yàn)證NFS共享是否成功
1. 在客戶端計(jì)算機(jī)上運(yùn)行以下命令,查看掛載點(diǎn)下的內(nèi)容:
ls /mnt/nfs
如果可以看到共享目錄中的文件和子目錄,說明NFS共享已成功。
2. 在遠(yuǎn)程服務(wù)器上檢查“/var/log/messages”文件,查找與NFS相關(guān)的日志信息,如果看到類似以下內(nèi)容的日志,說明NFS服務(wù)正在正常運(yùn)行:
“`
Mar 3 10:23:45 server kernel: NFS client version 3 called Mount(192.168.1.100://shared) from (192.168.1.200) at Mar 3 10:23:45 by user nobody on Linux version 3.10.0-514.el7.x86_64 (systemd-238) with TCP_NODELAY enabled (protocol in use PXE-RSP/MMU/HUD) using localtime(Crunchy) and nolock(vfs) options; protocol VFS_NOLOCK (tcp), Retry: yes (max=3), Timeout in isochronous mode set to 60 seconds (RPC_TIMEOUT=60). VFS error (device or resource busy), device or resource busy (192.168.1.100://shared) is not a directory or is empty. [kernel] IP table flush before namespace switch. [IPV4] NETLINK address family [genl]: autoconfig failed (-1): Checking for a default router now without sending any packets to the network! This might take a few minutes depending on your network setup! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unReachablE(NETLINK): No route to host, disconnecting … done.[iproute2-default(7)]: REJECT xmit queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only
本文標(biāo)題:centosnfs配置
鏈接地址:http://m.fisionsoft.com.cn/article/dhjieoc.html


咨詢
建站咨詢
