Fedora18 NFS伺服器終於搭建成功

2022-09-13 03:54:13 字數 2273 閱讀 6279

在win7上玩了幾天虛擬機器,覺得不是很爽!畢竟學的是linux,那好歹也得有個linux的學習環境,於是就安裝了雙系統。

好,回到正題。之前說道虛擬機器中samba的配置悲劇,其實這次也差不多。為了以後傳輸大檔案的需求,我沒有繼續那些例程的燒寫工作,而是開始了nfs伺服器的配置。這又是讓我抓耳撓腮的經歷。。。。。。

1,配置ip

pc端:ip:192.168.0.2  掩碼:255.255.255.0  閘道器:192.168.0.1  dns: 192.168.0.1

arm板:ip:192.168.0.3  掩碼:255.255.255.0  閘道器:192.168.0.1  dns: 192.168.0.1  #修改/etc/eth0-setting

2,關閉防火牆和selinux

service iptables stop

setenforce 0

3,配置/etc/exports

/home/chunix/arm  *(ro,sync,no_root_squash)

/home/chunix/share  192.168.0.*(ro,sync,no_root_squash) # test

4,開啟nfs伺服器

service nfs start  開啟服務  service nfs status  檢視狀態  service nfs stop  停止服務  service nfs restart  重啟服務

5,終端掛載

mount -t nfs -o nolock 192.168.0.2:/home/chunix/arm /mnt/nfsfolder

mount -t nfs -o nolock 192.168.0.2:/home/chunix/share /mnt/nfsfolder  # test

以上是大致配置過程,原本我想把原來出現錯誤的過程重現,但是結果卻是怎麼也看不到之前的錯誤,為了追求務實的精神,所以這裡我想分成兩部分來說:

一,本來寫這篇部落格想記錄的問題:

rpc mount export: rpc: unable to receive; errno = no route to host

說法,systemctl disable firewalld.service關閉了防火牆

vi /etc/sysconfig/selinux  修改selinux= disabled

停止了selinux

結果就ok了。

二,在測試過程遇到的問題:

結果錯誤提示為:

mount: 192.168.0.2:/home/chunix/share failed, reason given by server: permission denied

mount: mounting 192.168.0.2:/home/chunix/share on /mnt/nfsfolder failed: bad file descriptor

改共享資料夾的許可權 chmod 777 /home/chunix/share

這回決定先在pc上自己掛載看看:mount -t nfs localhost:/home/chunix/share /mnt

顯示錯誤:mount.nfs: access denied by server while mounting localhost:/home/chunix/arm

因為是在arm目錄掛載成功之後測試的,知道可能是因為防火牆問題,於是開始stop防火牆,順便說下,lokkit --disabled也能禁用防火牆(注意,第一次好像不能使用,我是在第一次使用了systemctl disable firewalld.service關閉了防火牆之後就能使用lokkit了)。但還是不行。掛載arm目錄還是可以。猜測是exports問題,於是,也把訪問許可權改成了全部允許,這次成了。掛載成功。

總結:1,搭建伺服器的注意點:防火牆,許可權

2,iptables只是ip 資訊包過濾和防火牆配置。

3,localhost不等於ip

4,/home/chunix/arm  *(ro,sync,no_root_squash)  

ip位址之後不要和()之間有空格,否則,該檔案即是對所有使用者開放。可以用exportfs -v檢視共享目錄狀態 

5,/home/chunix/arm  192.168.0.3(ro,sync,no_root_squash)  可以掛載

/home/chunix/arm  192.168.0.*(ro,sync,no_root_squash)  不可以掛載,不知道為什麼

6,經驗證,之前遇到的samba伺服器問題也是防火牆未完全關閉。

fedora20 nfs伺服器配置

板子在很多時候需要通過 nfs 協議讀取 mount 的檔案。1 安裝nfs服務和rpcbind 服務 yum install rpcbind yum install nfs utils 2 建立nfs server目錄,用於放置被遠端nfs訪問的檔案。mkdir opt nfsroot opt n...

fedora的nfs伺服器的安裝和啟動配置

安裝軟體包 服務端和客戶端都得安裝 nfs utils 這個是nfs服務主程式 包含rpc.nfsd rpc.mountd daemons rpcbind 這個是centos6.x的rpc主程式 centos5.x的為portmap yum install y nfs utils rpcbind 配...

nfs伺服器配置

nfs伺服器可以讓linux作業系統之間資料的傳送,比如你跑有linux系統的開發板和你linux電腦間資料傳送 在 etc exports 檔案中加一句話 nfs ser 192.168.0.rw,no root squash 儲存退出 nfs ser 其他linux機器 比如你的開發板 訪問的資...