安裝 nfs实昨, 加入開(kāi)機(jī)自啟動(dòng)侨把,啟動(dòng)Nfs
yum install nfs-utils.x86_64
chkconfig nfs on
service nfs start
修改路徑權(quán)限
cd /appdata
chmod -R 760 www/
nfs服務(wù)器上配置exports文件饥漫,更新是報(bào)錯(cuò)
[root@localhost appdata]# cat /etc/exports
/appdata/www/jscss 10.6.9.0.*(rw, sync, no_root_squash)
/appdata/www/pic 10.6.9.0.*(rw, sync, no_root_squash)
/appdata/www/html 10.6.9.0.*(rw, sync, no_root_squash)
[root@localhost appdata]# exportfs -rv
exportfs: /etc/exports:1: syntax error: bad option list
exportfs: No file systems exported!
查看資料后榨呆,發(fā)現(xiàn)exports文件中逗號(hào)后有空格,去掉再次更新
[root@nfsserver appdata]# cat /etc/exports
/appdata/www/jscss 10.6.9.0.*(rw,sync,no_root_squash)
/appdata/www/pic 10.6.9.0.*(rw,sync,no_root_squash)
/appdata/www/html 10.6.9.0.*(rw,sync,no_root_squash)
[root@nfsserver appdata]# exportfs -rv
exporting 10.6.9.0.*:/appdata/www/html
exporting 10.6.9.0.*:/appdata/www/pic
exporting 10.6.9.0.*:/appdata/www/jscss
在客戶端測(cè)試nfs服務(wù)器有哪些目錄可以掛載庸队,但掛載時(shí)提示權(quán)限拒絕
[root@nfsclient ~]# showmount -e 10.6.9.216
Export list for 10.6.9.216:
/appdata/www/html 10.6.9.0.*
/appdata/www/pic 10.6.9.0.*
/appdata/www/jscss 10.6.9.0.*
[root@nfsclient ~] mount -t nfs 10.6.9.216:/appdata/www/pic /www/pic
在nfs服務(wù)器上找到日志如下
[root@nfsserver appdata]# tail -f /var/log/messages
Dec 10 17:18:37 kmzyw-files rpc.mountd[6824]: refused mount request from 10.6.9.202 for /appdata/www/pic (/appdata/www/pic): unmatched host
再次檢查exports文件积蜻,發(fā)現(xiàn)匹配IP是10.6.9.0.*
,改成10.6.9.*
可成功掛載
[root@nfsclient /]# mount -t nfs 10.6.9.216:/appdata/www/pic /www/pic
[root@nfsclient /]# df -h | grep www
10.6.9.216:/appdata/www/pic 1008G 76M 957G 1% /www/pic
在客戶端添加開(kāi)機(jī)自動(dòng)掛載
[root@nfsclient /]# vim /etc/fstab
10.6.9.216:/appdata/www/pic /www/pic nfs defaults 0 0
10.6.9.216:/appdata/www/jscss /www/jscss nfs defaults 0 0
10.6.9.216:/appdata/www/html /www/html nfs defaults 0 0