版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010474681/article/details/78069294
在计算机集群中,往往需要文件共享。文件共享有很多方案。下面简单几个步骤,配置NFS服务来实现我们的项目需求。
当前服务器环境:centos6.5Final
rpcbind在旧版本的centos命名不同。
portmap新版下改名rpcbind
在虚拟机下做实验的时候,可先关掉防火墙和selinux,减少灵异事件发生的可能性。实验成功后再写防火墙配置文件。
下载:yum install -y nfs-utils rpcbind
vi /etc/selinux/config
将上述文件中的
SELINUX=enforcing
替换为
SELINUX=permissive
保存上述文件之后,运行以下命令:
setenforce 0
vi /etc/exports
/home/www 192.168.2.200(rw,sync)
设置开机自动启动
chkconfig nfs on
chkconfig rpcbind on
重启服务
service nfs start
service rpcbind start
检查防火墙
service iptables status
rpcinfo -p localhost
vi /etc/sysconfig/nfs
RQUOTAD_PORT=10001
LOCKD_TCPPORT=10002
LOCKD_UDPPORT=10002
MOUNTD_PORT=10003
STATD_PORT=10004
防火墙配置:
iptables -I INPUT -p tcp --dport 111 -j ACCEPT
iptables -I INPUT -p udp --dport 111 -j ACCEPT
iptables -I INPUT -p tcp --dport 2049 -j ACCEPT
iptables -I INPUT -p udp --dport 2049 -j ACCEPT
iptables -I INPUT -p tcp --dport 10001:10004 -j ACCEPT
iptables -I INPUT -p udp --dport 10001:10004 -j ACCEPT
service iptables save
service iptables restart
|
一、 yum install -y nfs-utils
然后挂载:
showmount -e 192.168.2.200
mount -t nfs 192.168.2.200:/home/www /home/www
二、
开机自动挂载vi /etc/fstab
192.168.2.200:/home/www /home/www nfs defaults 0 0
df -h
查看是否挂载成功!
结束!