centos 搭建svn服务器

本文详细介绍了如何在Fedora/CentOS/RHEL操作系统中安装并配置Subversion服务器的过程,包括转换为root用户、安装软件、创建SVN仓库、设置配置文件以及启动服务等步骤。

原创:http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/

1、转换成root用户
$ su root


2、安装subversion
[root@mim ~]# yum install mod_dav_svn subversion


3、增加svn用户
[root@mim ~]# htpasswd -cm /etc/svn-auth-users admin
New password: 
Re-type new password: 
Adding password for user admin


[root@mim ~]# htpasswd -m /etc/svn-auth-users zhangshan
New password: 
Re-type new password: 
Adding password for user zhangshan


[root@mim ~]# htpasswd -m /etc/svn-auth-users lisi
New password: 
Re-type new password: 
Adding password for user lisi


产生了用户配置文件:
[root@mim ~]# cat /etc/svn-auth-users 
admin:$apr1$ZFB1cXaa$XF3zhsiwQc3NwxkyOu.
zhangshan:$apr1$jdGTxfox$P8EosxpPLPuQ4lwCq/
lisi:$apr1$u6zDJipX$QFmlAjXaxPvW7rGaOi


4、创建svn repository
# mkdir /var/www/svn
# cd /var/www/svn
 
# svnadmin create testrepo
# chown -R apache.apache testrepo


/* 如果激活了SELinux(以“# sestatus ” 命令查询)的话,那么用以下的命令可以修改SELinux security context  
 If you have SELinux enabled (you can check it with "sestatus" command) 
 then change SELinux security context with chcon command */
 
# chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
 
/* Following enables commits over http */
# chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo


5、设置svn配置文件:/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/www/svn
   AuthType Basic
   AuthName "Subversion repositories"
   AuthUserFile /etc/svn-auth-users
   Require valid-user
</Location>


6、重启 Apache
# /etc/init.d/httpd restart
/* OR */
# service httpd restart
 
7、设置 /var/www/svn/testrepo/conf/svnserve.conf
/* Disable anonymous access */
anon-access = none
 
/* Enable access control */
authz-db = authz

------
Create “template” directories with following command:
# mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
Then import template to project repository using “svn import” command:
# svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags


8、http://serverIP/svn/testrepo

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值