服務端:
[root@localhost tmp]# rpm -qa | grep nfs
nfs-utils-lib-1.0.8-7.6.el5
nfs-utils-1.0.9-44.el5 //提供文件系統
system-config-nfs-1.3.23-1.el5
[root@localhost tmp]# rpm -qa | grep portmap
portmap-4.0-65.2.2.1 //提供rpc協議
[root@localhost tmp]# /etc/init.d/nfs restart
[root@localhost tmp]# /etc/init.d/portmap restart
[root@localhost tmp]# vim /etc/exports //配置文件,開始是空文件
/tmp 192.168.1.0/24(ro,no_root_squash) // 共享目錄 共享網段(共享出去之後的屬性)
[root@localhost tmp]# showmount -a //查看已經掛載共享目錄的客戶端/一般在服務器使用All mount points on localhost.localdomain:
192.168.1.200:/tmp
客戶端:
[root@localhost opt]# mount -t nfs 192.168.1.250:/tmp /opt
-t 指定文件系統類型
autofs自動掛載:
vim /etc/auto.master
/mynfs /etc/auto.nfs
vim /etc/auto.nfs
haha -fstype=nfs 192.168.1.250:/tmp
mkdir mynfs
/etc/init.d/autofs restart
[root@localhost opt]# showmount -e 192.168.1.250
Export list for 192.168.1.250:
/tmp 192.168.1.0/24 //客戶端可以查看服務器的共享