Skip to content

Centos 安装 nfs

检查 nfs 是否启动: 1、通过进程查看 nfs 服务是否运行

ps -aux|grep -v grep|grep nfs #有该进程即为开启状态

2、通过命令查看 nfs 服务的状态

/etc/init.d/nfs status 3、chkconfig 命令查询系统服务

chkconfig --list nfs 检查 nfs 是否安装:

rpm -qa|grep nfs rpm -qa|grep portmap centos 6.0 以上没有 portmap 变成了 rpcbind 检查有没有安装 rpcbind

rpm -qa|grep rpcbind 安装:

yum -y install nfs-utils rpcbind 服务端配置: #vi /etc/exports

文件内容: #/opt/issystem/docs 192.168.1.*(rw,sync,no_root_squash)

#service rpcbind start /restart/stop #service nfs start

查看 nfs 用到的所有端口 #rpcinfo -p localhost

防火墙增加如下端口: vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 53498 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 33180 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 38168 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 38439 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 55848 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 32812 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 41705 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 47329 -j ACCEPT

/etc/init.d/iptables restart 最后重启防火墙使配置生效

/etc/init.d/iptables save

/etc/init.d/iptables status 查看打开的端口

查询 nfs 的共享状态 showmount -e

显示已经与客户端连接上的目录信息

showmount -a 客户端:

mount -t nfs 10.245.8.27:/opt/issystem/docs /opt/issystem/docs 显示已经与服务端连接上的目录信息

showmount -e 10.245.8.27 检查客户端是否挂载成功和挂载路径

mount |grep nfs 设置 NFS 服务器的自动启动状态 对于实际的应用系统,每次启动 LINUX 系统后都手工启动 nfs 服务器是不现实的,需要设置系统在指定的运行级别自动启动 portmap 和 nfs 服务。

chkconfig --list portmap chkconfig --list rpcbind chkconfig --list nfs 设置 portmap 和 nfs 服务在系统运行级别 3 和 5 自动启动。

chkconfig --level 35 portmap on chkconfig --level 35 rpcbind on chkconfig --level 35 nfs on 如果新建文件没有写权限则配置

chmod 777 -R /opt/statics 卸载已挂载的 NFS 共享目录

umount /tmp/david/

最近更新