运行环境

[root@localhost sbin]$ cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 
[root@localhost sbin]$ uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

成功安装完SVN服务器

[root@localhost sbin]$ netstat -lntup
(No info could be read for "-p": geteuid()=1000 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name             
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      -

服务器端口打开正常。网上查询资料后发现以下原因因此有两种解决方案。
在CentOS7.0中默认使用firewall代替了iptables service。虽然继续保留了iptables命令,但已经仅是名称相同而已。除非手动删除firewall,再安装iptables,否则不能继续使用以前的iptables配置方法。
1)打开firewall的SVN的3690端口。执行以下语句,再重启firewall

[root@localhost sysconfig]# firewall-cmd --permanent --add-port=3690/tcp
success
[root@localhost sysconfig]# systemctl restart firewalld.service

2)卸载firewall,安装iptables service,再打开SVN的3690端口。

[root@localhost sysconfig]# systemctl stop firewalld.service
[root@localhost sysconfig]# systemctl disable firewalld.service
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
[root@localhost sysconfig]# yum install iptables-services
已加载插件:fastestmirror
base                                                                                    | 3.6 kB  00:00:00     
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 iptables-services.x86_64.0.1.4.21-13.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
===============================================================================================================
 Package                          架构                  版本                         源                   大小
===============================================================================================================
正在安装:
 iptables-services                x86_64                1.4.21-13.el7                base                 49 k
事务概要
===============================================================================================================
安装  1 软件包
总下载量:49 k
安装大小:23 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : iptables-services-1.4.21-13.el7.x86_64                                                     1/1 
  验证中      : iptables-services-1.4.21-13.el7.x86_64                                                     1/1 
已安装:
  iptables-services.x86_64 0:1.4.21-13.el7                                                                     
完毕!
[root@localhost sysconfig]# systemctl start iptables.service##记住打开iptables才能确定是否打开端口成功。
[root@localhost sysconfig]# cp iptables iptables_bak
[root@localhost sysconfig]# ll iptables*
-rw-------. 1 root root  550 6月  10 2014 iptables
-rw-------. 1 root root  550 3月  16 22:24 iptables_bak
-rw-------. 1 root root 1974 3月  16 21:38 iptables-config
[root@localhost sysconfig]# vi /etc/sysconfig/iptables
[root@localhost sysconfig]# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 3690 -j ACCEPT ##一次修改
[root@localhost sysconfig]# vim iptables
-A INPUT -m tcp -p tcp --dport 3690 -j ACCEPT ##我把这条命令添加的配置文件
[root@localhost sysconfig]# service iptables restart##重启iptables
[root@localhost sysconfig]# /sbin/iptables -L -n##查看端口是否打开
参考:
 
按需要进行配置,切勿关闭防火墙造成安全隐患
版权声明:本文为李维亮博主的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:http://www.liweiliang.com/342.html

标签: svn, linux

评论已关闭