1. 檢查是否已安裝NFSvim
rpm -qa | grep nfs
rpm -qa | grep portmap
2. 安裝NFSasync
yum install nfs-utils*
chkconfig nfs on
chkconfig rpcbind on
service nfs restart
service rpcbind restart
service nfs status
service rpcbind status
3. 配置防火牆tcp
cd /etc/sysconfig cp nfs nfs.bak vim nfs RQUOTAD_PORT=875 LOCKD_TCPPORT=32803 LOCKD_UDPPORT=32769 MOUNTD_PORT=892 echo "mountd 892/tcp" >> /etc/services echo "mountd 892/udp" >> /etcservices echo "rquotad 875/tcp" >> /etc/services echo "rquotad 875/udp" >> /etc/services echo "nlockmgr 32803/tcp" >> /etc/services echo "nlockmgr 32769/udp" >> /etc/services service nfs restart iptables -A INPUT -p tcp --dport 111 -j ACCEPT iptables -A INPUT -p udp --dport 111 -j ACCEPT iptables -A INPUT -p tcp --dport 892 -j ACCEPT iptables -A INPUT -p udp --dport 892 -j ACCEPT iptables -A INPUT -p tcp --dport 875 -j ACCEPT iptables -A INPUT -p udp --dport 875 -j ACCEPT iptables -A INPUT -p tcp --dport 2049 -j ACCEPT iptables -A INPUT -p udp --dport 2049 -j ACCEPT iptables -A INPUT -p tcp --dport 32803 -j ACCEPT iptables -A INPUT -p udp --dport 32803 -j ACCEPT iptables -A INPUT -p tcp --dport 32769 -j ACCEPT iptables -A INPUT -p udp --dport 32769 -j ACCEPT service iptables save
4. 配置NFS測試
vim /etc/exports
/nfs *(insecure,rw,async,no_root_squash) *(ro)
5. 掛載測試spa
showmount -e 10.166.80.15
移除掛載目錄rest
umount 掛載目錄 例:umount /upload
掛載code
mount nfs主機名:nfs共享目錄 掛載到本機的目錄