设为首页 收藏本站
查看: 4697|回复: 0

[经验分享] apache搭建svn服务器

[复制链接]

尚未签到

发表于 2015-8-4 10:51:39 | 显示全部楼层 |阅读模式
  2010年项目开发过程中 试用了svn作为版本控制,使用TortoiseSVN客户端,同时用apache配置成浏览器访问,更加方便,此文就是记录配置过程,记录解决问题过程的。
  
  安装


apt-get install subversion subversion-tools apache2 libapache2-svn  

创建储存库


svnadmin create /home/machine/svn/aviation  创建一个新的空储存库,数据储存方式默认采用Berkeley DB。


导入源码



svn import /home/machine/jdeproject/aviation file:////home/machine/svn/aviation
配置
配置文件位于/etc/apache2/mods-enabled/目录下,配置文件共有两个,分别是dav_svn.conf和dav_svn.load,dav_svn.load文件负责装载必要的模块,dav_svn.conf是mod_dav_svn.so模块的配置文件,修改:


1 # dav_svn.conf - Example Subversion/Apache configuration
2 #
3 # For details and further options see the Apache user manual and
4 # the Subversion book.
5 #
6 # NOTE: for a setup with multiple vhosts, you will want to do this
7 # configuration in /etc/apache2/sites-available/*, not here.
8
9 #  ...
10 # URL controls how the repository appears to the outside world.
11 # In this example clients access the repository as http://hostname/svn/
12 # Note, a literal /svn should NOT exist in your document root.
13
14   #设置访问路径
15   
16
17   # Uncomment this to enable the repository
18   #启用
19   DAV svn
20
21   # Set this to the path to your repository
22   #设置储存库路径,仅支持单个储存库,该路径要可被Apache进程访问。
23   SVNPath /home/machine/svn/aviation
24   # Alternatively, use SVNParentPath if you have multiple repositories under
25   # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
26   # You need either SVNPath and SVNParentPath, but not both.
27   #SVNParentPath /var/lib/svn
28
29   # Access control is done at 3 levels: (1) Apache authentication, via
30   # any of several methods.  A "Basic Auth" section is commented out
31   # below.  (2) Apache  and , also commented out
32   # below.  (3) mod_authz_svn is a svn-specific authorization module
33   # which offers fine-grained read/write access control for paths
34   # within a repository.  (The first two layers are coarse-grained; you
35   # can only enable/disable access to an entire repository.)  Note that
36   # mod_authz_svn is noticeably slower than the other two layers, so if
37   # you don't need the fine-grained control, don't configure it.
38
39   # Basic Authentication is repository-wide.  It is not secure unless
40   # you are using https.  See the 'htpasswd' command to create and
41   # manage the password file - and the documentation for the
42   # 'auth_basic' and 'authn_file' modules, which you will need for this
43   # (enable them with 'a2enmod').
44   #启用Apache基础验证
45   AuthType Basic
46   #设置验证框标题
47   AuthName "Subversion Repository"
48   #指定验证用户文件名
49   AuthUserFile /etc/apache2/dav_svn.passwd
50
51   # To enable authorization via mod_authz_svn
52   #启用目录级别授权,dav_svn.authz是授权配置文档
53   #AuthzSVNAccessFile /etc/apache2/dav_svn.authz
54
55   # The following three lines allow anonymous read, but make
56   # committers authenticate themselves.  It requires the 'authz_user'
57   # module (enable it with 'a2enmod').
58   #
59   #允许匿名访问,不允许Commit,不能与AuthzSVNAccessFile同时使用
60   Require valid-user
61   #
62
63
权限修改
修改/home/machine/jdeproject/aviation/目录访问权限使它可被Apache进程访问,也就是其他用户可访问.


drwxr-xr-x 6 machine machine 4096 10-27 19:25 aviation
添加授权
通过Apache的用户验证功能可以区别匿名用户和验证用户,从而赋予匿名用户读权限和验证用户读/写的权限。授权文档dav_svn.conf定义:etc/apache2/dav_svn.authz,它的内容如下:


# 定义组
[groups]            
# 定义admin组及组内的用户
admin = machine
# 定义user组及组内的用户
users = zhao,song
# 定义根的权限
[/]        
# 全部用户不具备任何权限
*=              
# admin组具备读写权限      
@admin = rw     
# user具备只读权限
@user = r         
添加用户


htpasswd -c /etc/apache2/dev_svn.passwd machine
New password:
Re-type new password:
#省略添加其他用户的过程,注意参数,首次创建需要-c,增加的时候只要-d
htpasswd -d /etc/apache2/dev_svn.passwd song
New password:
Re-type new password:使用
现在可以在浏览器中输入http://127.0.0.1/aviation访问源代码,可以使用svn客户端管理源代码了。:)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-94004-1-1.html 上篇帖子: Tomcat7出现HTTP Status 500 下篇帖子: Windows下Apache+Tomcat+jsp+php的服务器整合配置经验总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表