歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Fedora 17 x64如何配置nfs服務

Fedora 17 x64如何配置nfs服務

日期:2017/2/28 15:43:14   编辑:Linux教程

測試環境:

[root@tp system]# uname -a
Linux tp 3.3.4-5.fc17.x86_64 #1 SMP Mon May 7 17:29:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

配置nfs exports:

vim /etc/exports

/run/media/k/Elements/unzip/ora11gR2forLinux64 192.168.221.0/24(rw,sync,no_root_squash)

激活exports,可直接用exportfs刷新或者重啟服務:

1. exportfs刷新:

[root@tp system]# exportfs -avf
exporting 192.168.221.0/24:/run/media/k/Elements/unzip/ora11gR2forLinux64
2. 重啟服務:
[root@tp system]# systemctl restart nfs-server.service

查看本機共享出的nfs文件夾:

[root@tp system]# showmount -e
Export list for tp:
/run/media/k/Elements/unzip/ora11gR2forLinux64 192.168.221.0/24

換台機器掛載nfs文件夾:

[root@rac1 ~]# mount -t nfs 192.168.221.1:/run/media/k/Elements/unzip/ora11gR2forLinux64 /mnt
[root@rac1 ~]# df -h
文件系統 容量 已用 可用 已用% 掛載點
/dev/mapper/VolGroup00-LogVol00
188G 2.7G 176G 2% /
/dev/sda1 99M 23M 71M 25% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sr0 3.6G 3.6G 0 100% /media
192.168.221.1:/run/media/k/Elements/unzip/ora11gR2forLinux64
932G 806G 127G 87% /mnt
[root@rac1 ~]#

注意問題:

1. 檢查配置沒有問題後,仍無法發現nfs共享,可以先臨時關閉防火牆(systemctl stop iptables.service)和SELINUX(setenforce 0),再試試看。

2. 客戶機上能發現nfs共享,並且可以成功mount,但是沒有權限列出mount後的目錄,需要加no_root_squash到nfs exports選項裡,這樣客戶機能以root權限來查看nfs共享文件夾。

man exports

root_squash
Map requests from uid/gid 0 to the anonymous uid/gid. Note that
this does not apply to any other uids or gids that might be
equally sensitive, such as user bin or group staff.

no_root_squash
Turn off root squashing. This option is mainly useful for disk‐
less clients.

Copyright © Linux教程網 All Rights Reserved