centos 安装svn server( http https )

安装必要的包

sudo yum install httpd subversion mod_dav_svn

创建仓库

sudo mkdir -p /var/lib/subversion/repositories
sudo chown -R apache:apache /var/lib/subversion

创建工程

sudo svnadmin create --fs-type fsfs /var/lib/subversion/repositories/xxx
sudo chown -R apache:apache /var/lib/subversion/repositories/xxx
sudo chmod -R g+w /var/lib/subversion/repositories/xxx
sudo chmod g+s /var/lib/subversion/repositories/xxx/db

在 /etc/httpd/conf.d/新建一个文件

subversion.conf

其内容如下:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /svn>
  DAV svn
  SVNParentPath /var/lib/subversion/repositories
  SVNListParentPath on
  SVNPathAuthz off
  AuthType Basic
  AuthName "subversion respository"
  AuthUserFile /etc/svn-auth-users
  Require valid-user
</Location>

创建用户名密码

sudo htpasswd -c /var/lib/subversion/passwords xxxx

上面的xxxx就是你的用户名,之后会让你输入密码。

重新启动httpd

sudo service httpd restart

现在访问

http://www.xxxxx.com/svn

就会弹出svn的登录框,xxxxx是你的域名

但是为了安全,我们可以强制使用https,

只要在Location中加入:

SSLRequireSSL on

就可以了,此时如果再使用http就会报错,必须使用https

<Location /svn>
  DAV svn
  SSLRequireSSL on
  SVNParentPath /var/lib/subversion/repositories
  SVNListParentPath on
  SVNPathAuthz off
  AuthType Basic
  AuthName "subversion respository"
  AuthUserFile /etc/svn-auth-users
  Require valid-user
</Location>

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:

Leave a Reply

Your email address will not be published. Required fields are marked *