你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 5.5配置NFS服务器教程

[日期:2013-03-27] 来源:Linux社区  作者:lxw66 [字体: ]
说明:
NFS服务器:
操作系统:CentOS 5.5
IP:192.168.1.1
nfs网络文件服务器共享目录:/www

本地目录 /www所有者:www(说明:www为创建的nfs运行账号,也可以是其它程序的运行账号,如nginx的运行账号)
chown -R nfs:nfs /www
目录权限:777
chmod -R 777 /www

NFS客户端:
操作系统:CentOS 5.5
IP:192.168.1.2
把NFS服务器上的目录/www 挂载到本地目录/opt中

本地目录 /opt所有者:www(说明:www为创建的nfs运行账号,也可以是其它程序的运行账号,如nginx的运行账号)
chown -R nfs:nfs /opt
目录权限:777
chmod -R 777 /opt

----------------------------------------------------------------------------------------------------------------------
Nfs服务器端
创建nfs运行账号
[root@localhost ~]# useradd nfs

创建共享目录,并更改权限
[root@localhost ~]# mkdir /www
[root@localhost ~]# chown -R nfs:nfs /www/
[root@localhost ~]# chown -R 777 /www/

更改selinux机制为禁止
[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=disabled

写防火墙规则或直接关掉
[root@localhost ~]# service iptables save
[root@localhost ~]# vim /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 1001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1002 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 1002 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1003 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 1003 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1004 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 1004 -j ACCEPT
[root@localhost ~]# /etc/init.d/iptables restart #最后重启防火墙使配置生效
防火墙端口说明:
portmap或者rpcbind(CentOS 6.x)使用:tcp/udp 111
nfs使用:tcp/udp 2049
mountd使用: TCP/UDP 892
rquotad使用:tcp/udp 875
status使用: TCP/UDP 1001-1004共四个端口
nlockmgr使用:TCP/32803端口 UDP/32769端口
linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款