linux apache +svn

来源:互联网 发布:如何访问mpp数据库 编辑:程序博客网 时间:2024/05/01 10:33

1.

svn server(subversion):

svn client(TortoiseSVN):下载地址(http://tortoisesvn.net/downloads.html)

2.准备epel源

[root@localhost ~]# rpm  -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.HjLnDh: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]更新epel源仓库:
[root@localhost ~]# yum repolist

3.安装相关软件包

[root@localhost ~]# yum -y install httpd httpd-devel mod_dav_svn subversion mod_ssl 
httpd,mod_dav_svn,httpd-devel,mod_ssl支持WEB形式管理SVN
subversion (SVN服务器)

4.查看是否安装了svn模块

[root@localhost ~]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
 
#查看svn版本:
[root@localhost ~]# svn --version
svn, version 1.6.11 (r934486)
   compiled Mar  6 2014, 10:49:10
 
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
 
The following repository access (RA) modules are available:
 
* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

5.svn服务器的配置:

新建一个目录用于存储SVN所有文件

 
[root@localhost ~]# mkdir /data/svn -p

 

新建一个版本仓库

[root@localhost ~]# svnadmin create /data/svn/
[root@localhost ~]# cd /data/svn/
[root@localhost svn]# ls
conf  db  format  hooks  locks  README.txt
#更改/data/svn属主属组:
[root@localhost svn]# chown -R apache.apache /data/svn/

6.配置subversion.conf

加载mod_dav_svn模块,一般apache2己正常加载这两个模块  apache需要加载mod_dav_svn模块。如果apache是按照与预设目录安装的,mod_dav_svn模块应该会安装在apache安装位置(默认路径是/etc/httpd/)的 modules子目录内。同时apache的配置文件httpd.conf(默认路径为etc/httpd/conf/)中已经使用LoadModule指令加载了该模块(如果没有,手动添加)注意这个指令必须出现在其它的Subversion相关指令之前。还要加载mod_authz_svn.so模块。

[root@localhost conf.d]# vim /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 /repos>
    DAV svn
    SVNParentPath /usr/local/fulilaila/svn
#
#   # Limit write permission to list of valid users.
#   <LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
       AuthType Basic
       AuthName "Authorization Realm"
       AuthzSVNAccessFile /usr/local/fulilaila/svn/authz
       AuthUserFile /usr/local/fulilaila/svn/passwd
       Require valid-user
#   </LimitExcept>
</Location>

7.添加用户和密码:

[root@localhost conf.d]# htpasswd -c /data/svn/passwdfile kaibin
New password: 
Re-type new password: 
Adding password for user kaibin
[root@localhost conf.d]# htpasswd /data/svn/passwdfile zhangsan
New password: 
Re-type new password: 
Adding password for user zhangsan

8.重启apache

[root@localhost ~]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:

9下面创建权限访问控制文件,可自行查看具体权限:

# vim /data/svn/accessfile
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').


[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average


[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin=admin
test_developer=aa,bb,cc


# [/foo/bar]
# harry = rw
# &joe = r
# * =


# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = ra
[/]
@admin=rw
[repository:/]
@test_developer=rw

10.启动svn服务器

 
[root@localhost svn]# svnserve -d -r /data/svn

0 0
原创粉丝点击