debian 安装svn apache 小记. AuthzSVNAccessFile 不生效问题.

1,安装 apache ,svnapt-get install apache2 subversion libapache2-svn

不安装apache  是不能通过http方式来访问的.

subversion服务器是不需要apache的,但是可以使用apache,视具体情况来选择。
        1、如果只要通过file://或svn://来访问,则不需要apache,只安装svn即可,使用svnserve来作为服务。
        2、如果你要建立一个可以通过http://或https://来访问的版本库服务器,则你需要使用apache。

2,版本信息.

root# svn --version
svn, version 1.6.17 (r1128011)
compiled Dec 20 2014, 19:48:25

root#apachectl -v

Server version: Apache/2.2.22 (Debian)
Server built: Dec 23 2014 22:48:32

3,创建版本库并将所有权转让给apache2

svnadmin create  /disk1/d1/svn/project

chown www-data:www-data -R  /disk1/d1/svn/project

4,修改 /etc/apache2/mods-enabled/dav_svn.conf

实际上是软件连接:

[email protected]:/etc/apache2/mods-enabled# ls -l

lrwxrwxrwx 1 root root 30 Jul 2 17:05 dav_svn.conf -> ../mods-available/dav_svn.conf

对应了 /mods-available/dav_svn.conf  这个文件.

打开这个文件可见内容.网上很多版本的dav_svn.conf已经不是最新的版本了.

[email protected]:/etc/apache2/mods-enabled# cat 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
  #SVNParentPath /disk1/d1/svn/project
  # 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 /disk1/d1/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>

5,修改svn权限设置,权限主体可为个人或小组,以目录为节点设置读/写位,下面是样例:

/etc/apache2/dav_svn.authz目录结构svn---+++++++project++++++++++++++Client++++++++++++++++++++test1++++++++++++++Document
[groups]
admin = test1,test2
group_a =test3

[svn:/]
*=
[project:/]
*=

@admin =rw


[project:/Client]
*=

@group_a=rw

@admin=rw
[project:/Client/test1]
*=
test1=rw
[project:/Document]
*=
test2=rw

 

*=空 是没有权限 ,

r 读取

w写入 权限

6. 创建账户

#/etc/apache2

//首次加 -c
htpasswd -c dav_svn.passwd test
//
htpasswd dav_svn.test2

重置密码:

[email protected]:/etc/apache2# htpasswd --help
Usage:
        htpasswd [-cmdpsD] passwordfile username
        htpasswd -b[cmdpsD] passwordfile username password

        htpasswd -n[mdps] username
        htpasswd -nb[mdps] username password
 -c  Create a new file.
 -n  Don‘t update file; display results on stdout.
 -m  Force MD5 encryption of the password (default).  # -m 重置密码
 -d  Force CRYPT encryption of the password.
 -p  Do not encrypt the password (plaintext).
 -s  Force SHA encryption of the password.
 -b  Use the password from the command line rather than prompting for it.
 -D  Delete the specified user.
On other systems than Windows, NetWare and TPF the ‘-p‘ flag will probably not work.
The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.

#

htpasswd -m dav_svn.passwd liutxxx



7,重启apache生效

[email protected]:/etc/apache2# service apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server‘s fully qualified domain name, using 10.175.197.65 for ServerName
... waiting apache2: Could not reliably determine the server‘s fully qualified domain name, using 10.175.197.65 for ServerName
.

8,访问.

去网页打开 http://127.0.0.1/svn/project/Document/

发现所有用户都能访问,权限不生效.

一度怀疑:

1,权限文件路径是否正确

2,权限文件 dav_svn.authz 是否chmod 777 dav_svn.authz

3,重点...

老版本是报 "apache报非法指令‘AuthzSVNAccessFile‘ " 但新版本没有报错,却原因一样.

重启apache报非法指令‘AuthzSVNAccessFile‘,那么很可能是‘authz_svn_module‘没加载或apache自己加载顺序的问题,可以在 mods-available/dav.load手动加载该模块解决问题。(添加下文中的最后一行即可)

参考网址:http://www.cnblogs.com/liuyangnuts/archive/2013/03/19/2965256.html

# file: /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

新版本 不会报AuthzSVNAccessFile 只会没有权限,这点恶心了我一天.

重启apache : service apache2 restart

再去网页看看,能正确验证权限.

至此 svn 的搭建完成了.

时间: 2024-11-05 12:32:14

debian 安装svn apache 小记. AuthzSVNAccessFile 不生效问题.的相关文章

debian 安装svn

centos安装subversion1.10.2的经历 (2018-09-06 13:08:59) 转载▼   分类: 技术类 安装步骤 1.下载subversion1.10.2 apr apr-util sqlite serf scons(安装这个才能安装serf) 选择1.5.2版本的.1.6以上版本安装总会报错 wget https://mirrors.tuna.tsinghua.edu.cn/apache/subversion/subversion-1.10.2.tar.gz wget

Centos 6.4安装配置apache平台的svn服务器

一.安装apache.subversion服务 #yum install httpd subversion subversion-devel mod_dav_svn -y 二.配置apache服务器 # sed '{/^$/d;/#/d}' /etc/httpd/conf/httpd.conf ServerTokens OS ServerRoot "/etc/httpd" PidFile run/httpd.pid Timeout 60 KeepAlive Off MaxKeepAli

Linux下搭建SVN+Apache环境【源码安装】

操作系统:redhat6.4(64位) 一.SVN介绍 SVN是一个版本控制工具,Subversion的版本库(repository),就是位于服务器,统一管理和储存数据的地方. 题外话,搭建SVN服务器apache是必须的吗? Subversion(SVN)作为一个单独的版本管理软件是不具备网页浏览功能的.就是说,你可以用版本管理的客户端比如:TotoriseSVN来和SVN服务器进行连接.这样如果你的电脑没有安装SVN客户端就不能使用SVN服务器提供的服务了.为了实现请客户端的目标,就想通过

yum/源码编译安装配置apache+svn

本次整理的比较急.源码编译和命令解释后续加上.不多说开始吧 系统环境:CentOS6.5_x86_64 minimal YUM版 1.检查是否安装了httpd.mod_dav_svn(实现apache+svn的一个模块).subversion(默认是安装的.需要yum remove subversion卸载掉) [[email protected] ~]# rpm -ql httpd package httpd is not installed [[email protected] ~]# rp

SVN+apache安装部署

一,安装软件: 安装apache #yum  install httpd 安装subversion #yum install subversion* 安装需要的模块mod_dav_svn #yum -y install mod_dav_svn 二,创建版本库并开始配置svn 1,创建版本库 创建目录结构 #mkdir -p /var/svn              注:/var/svn 是SVN的库存放目录     /var/svn/repos是svn的库根/ 2.运行创建版本库的命令,指定数

svn + apache 安装

系统:centos6.3 svn:  subversion-1.6.1 apache: httpd-2.2.29 //创建svn路径 [[email protected] /]# mkdir svn [[email protected] opt]# wget http://subversion.tigris.org/downloads/subversion-deps-1.6.1.tar.gz [[email protected] opt]# wget  http://subversion.tig

svn+apache+ssl安装配置,通过SSL访问

系统环境: [[email protected] conf]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [[email protected] conf]# uname -r 3.10.0-327.el7.x86_64 安装SVN [[email protected] conf]# yum install -y subversion #安装SVN [[email protected] ~]# svn --versio

debian 安装ruby +nginx+apache开发环境.

安装软件 1.很简单, 前提你安装了apache, mysql, nginx 如果没有 加上. #apt-get installapache2 nginx 2.开启apache的重写. #a2enmod rewrite #apt-get install mysql-server 3.下面会安装ruby, apache的ruby模块, mysql的ruby支持, vim的rails支持. #apt-get install ruby rails rubygems rake  libapache2-m

centos 6.7下安装redmine+svn+apache

系统环境 cat /etc/redhat-release CentOS release 6.7 (Final) uname -r 2.6.32-573.el6.x86_64 1.替换yum源为163.大家都是高手,这里不做详细的交代了. 把这个文件放到/etc/yum.reop下. yum install -y update 关闭和清理防火墙和selinux 2. mkdir /tools cd /tools wget https://dl.fedoraproject.org/pub/epel/