http协议访问ubuntu的svn服务

http协议访问ubuntu的svn服务

访问svn服务器,一种基于svn协议,一种基于http协议(Apache),遵循http服务是基于Apache的subversion界面化的操作更是易于管理和操作。尤其对没有接触svn的运维人员,http访问版本服务器明显优于svn版本服务器。下面介绍下如何配置让ubuntu svn服务器能够使用http访问。

ubuntu安装subversion,并且配置完成后,能够使用svn://IP地址/代码仓库路径访问后。

一.安装apache2及其依赖的库libapache2-svn

sudo apt-get update
sudo apt-get install apache2
sudo apt-get install libapache2-svn

二.配置apache2

1.进入/etc/apache2/mods-available,配置dav_svn.conf

# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.

# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
<Location /svn>

  # Uncomment this to enable the repository
  DAV svn

  # Set this to the path to your repository
  #SVNPath /var/lib/svn
  # Alternatively, use SVNParentPath if you have multiple repositories under
  # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
  # You need either SVNPath and SVNParentPath, but not both.
  SVNParentPath /opt/svn/

  # Access control is done at 3 levels: (1) Apache authentication, via
  # any of several methods.  A "Basic Auth" section is commented out
  # below.  (2) Apache <Limit> and <LimitExcept>, also commented out
  # below.  (3) mod_authz_svn is a svn-specific authorization module
  # which offers fine-grained read/write access control for paths
  # within a repository.  (The first two layers are coarse-grained; you
  # can only enable/disable access to an entire repository.)  Note that
  # mod_authz_svn is noticeably slower than the other two layers, so if
  # you don't need the fine-grained control, don't configure it.

  # Basic Authentication is repository-wide.  It is not secure unless
  # you are using https.  See the 'htpasswd' command to create and
  # manage the password file - and the documentation for the
  # 'auth_basic' and 'authn_file' modules, which you will need for this
  # (enable them with 'a2enmod').
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd   #用户名密码配置文件

  # To enable authorization via mod_authz_svn (enable that module separately):
  #<IfModule mod_authz_svn.c>
  AuthzSVNAccessFile /etc/apache2/dav_svn.authz    #用户权限配置
  #</IfModule>

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
  #<LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  #</LimitExcept>

</Location>

2.创建用户名和密码
sudo htpasswd -c /etc/apache2/dav_svn.passwd admin
admin 用户名
后面根据提示输入密码即可
在这里插入图片描述
3.进入 /etc/apache2 修改用户的权限文件:dav_svn.authz
用户组权限为空+用户权限
在这里插入图片描述
4.修改dav_svn.authz,dav_svn.passwd 权限
sudo chmod 777 dav_svn.authz,dav_svn.passwd

5.进入/etc/apache2/mods-available,配置dav.load,否则报错如下
在这里插入图片描述
修改配置如下


LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so
#添加下面一行
LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so

6.重启服务
开启svn服务
svnserve -d -r /opt/svn
重启服务
sudo service apache2 restart

报错
在这里插入图片描述
修改方法
在/etc/apache2/apache2.conf最后添加
ServerName localhost:80

重新执行
开启svn服务
svnserve -d -r /opt/svn
重启服务
sudo service apache2 restart

完成,下面可以通过http://192.168.21.129/svn访问svn服务器了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值