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

被折叠的 条评论
为什么被折叠?



