1. Environment Description
# Uname-
Linux df53l 2.6.28-gentoo-r5 #1 SMP Tue Jun 16 18:58:24 CST 2009 i686
Intel (r) Pentium (r) Dual CPU e2160 @ 1.80 GHz genuineintel GNU/Linux
# Emerge-PV Apache
[Ebuild R] www-servers/Apache-2.2.11 use = "SSL
-Debug-doc-LDAP (-SELinux)-SNI-static-suexec-threads "apache2_modules =" actions
Alias auth_basic authn_alias authn_anon authn_dbm authn_default
Authn_file authz_dbm authz_default authz_groupfile authz_host
Authz_owner authz_user Autoindex cache Dav dav_fs dav_lock deflate dir
Disk_cache env expires ext_filter file_cache filter headers include
Info log_config logio mem_cache mime mime_magic negotiation rewrite
Setenvif speling status unique_id userdir UserTrack vhost_alias
# Emerge-PV Dev-util/Subversion
[Ebuild R] Dev-util/subversion-1.6.2 use = "apache2 dso nls Perl Python WebDAV-neon
-Bash-completion-berkdb-ctypes-Python-debug-doc-emacs-extras-gnome-keyring-Java-ruby-sasl-test-vim-syntax-WebDAV-serf"
# Emerge-PV www-apps/websvn
[Ebuild R] www-apps/websvn-2.1.0 use = "vhosts
-Enscript"
2. Install software
# Echo "www-servers/Apache SSL">/etc/portage/package. Use
#
Echo "Dev-lang/PHP apache2 PCRE session spl xml MySQL and either GD
Suhosin CGI for CE-CGI-redirect ">/etc/portage/package. Use
# Echo "Dev-util/subversion-berkdb apache2 WebDAV-neon-nowebdav">/etc/portage/package. Use
# Echo "www-apps/websvn vhosts">/etc/portage/package. Use
# Echo "apache2_mpms =" prefork ">/etc/make. conf
# Emerge-AV www-servers/Apache Dev-lang/PHP Dev-util/subversion www-apps/websvn
3. Configure Apache
# Webapp-config-I-H websvn 2.1.0
Check/var/www/websvn
Whether the directory is generated.
# Vim/etc/CONF. d/apache2
Add the following lines after the original apache2_opts
Apache2_opts = "$ apache2_opts-D default_vhost-D svn-D svn_authz-D Dav-D dav_fs-d ssl-D ssl_default_vhost"
# Vim/etc/apache2/httpd. conf
Add the following content
# For websvn
Listen 8099.
<Directory/var/www/websvn>
Php5-cgi. php addhandler
Options + indexes + execcgi + followsymlinks
Directoryindex index. php
AllowOverride limit
</Directory>
# Vim/etc/apache2/vhosts. d/websvn-vhost.conf
Add the following content
Namevirtualhost*: 8099
<Virtualhost *: 8099>
Servername "myserver.mydomain.com"
DocumentRoot "/var/www/websvn/htdocs"
<Directory "/var/www/websvn/htdocs">
Php5-cgi. php addhandler
Directoryindex index. php
AllowOverride all
Order allow, deny
Allow from all
</Directory>
</Virtualhost>
# Vim/etc/apache2/modules. d/php5-cgi.conf
Add the following content
# Handler for PHP 5 scripts
<Ifdefine php5cgi>
ScriptAlias/php5-cgi/usr/lib/PhP5/bin/PHP-CGI
Action php5-cgi/php5-cgi
Addhandler php5-cgi. PhP5
</Ifdefine>
4. Configure Subversion
I soft-linked the/var/SVN directory to/home/SVN for Bucket Management
# Mkdir/home/SVN
# Ln-S/home/SVN/var
Configure Subversion
# Emerge -- config Subversion
Create SVN User Group
# Groupadd svnusers
Create SVN users
# Adduser-G svnusers-M SVN
# Passwd SVN
Modify Directory Access Permissions
# Chown-r SVN: svnusers/var/SVN/Repos
# Chown-r root: svnusers/var/SVN/Repos
# Chmod-r g-W/var/SVN/Repos
# Chmod-r g + RW/var/SVN/repos/DB
# Chmod-r g + RW/var/SVN/repos/locks
# Gpasswd-A Crob svnusers
5. Configure Apache and websvn
# Vim/etc/apache2/modules. d/47_mod_dav_svn.conf
If the file already exists, delete the original content and change it to the following content:
<IfDefine SVN>
<IfModule !mod_dav_svn.c>
LoadModule dav_svn_module modules/mod_dav_svn.so
</IfModule>
<Location /svn/repos>
DAV svn
SVNParentPath /var/svn
#SSLRequireSSL
AuthType Basic
AuthName "Super Duper SVN Repository"
AuthUserFile /var/svn/conf/svnusers
AuthzSVNAccessFile /var/svn/conf/svnpolicy
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
SVNIndexXSLT /svnindex.xsl
</Location>
<IfDefine SVN_AUTHZ>
<IfModule !mod_authz_svn.c>
LoadModule authz_svn_module modules/mod_authz_svn.$
</IfModule>
</IfDefine>
</IfDefine>#vim /var/www/websvn/htdocs/include/config.php
Add the following content
$ Config-> parentpath ('/var/SVN /');
6. Restart
#/Etc/init. d/apache2 restart
7. Subversion repository creation script
# Vim setup-repos.sh.
The content is as follows:
#! /Bin/bash
# Dependencies:
# App-shells/bash (BASH)
# Sys-apps/coreutils (mktemp ,...)
# Dev-util/subversion (SVN, svnadmin)
If [! -D/var/SVN/]; then
Echo "cant find SNV-directory at/var/SVN"
Exit 1
Fi
If [-Z $1]; then
Echo "Usage: $0 <repository-Name>"
Exit 1
Fi
If [-D/var/SVN/$1]; then
Echo "repository/var/SVN/$1 is already present"
Exit 1
Fi
Echo "creating repository ..."
Svnadmin create/var/SVN/$1
Echo "creating default directories ..."
Tdir = 'mktemp-d'
CD $ tdir
Mkdir-P {trunk, tags, branches}
Echo "Initial import ..."
SVN import-Q-M "Initial import" -- non-interactive $ tdir file: // var/SVN/$
Echo "fixing permissions ..."
Chown-r Apache/var/SVN/$1
Echo "cleaning up ..."
Rmdir $ tdir/{trunk, tags, branches}
Rmdir $ tdir
Echo "done! "
# Chmod + X./setup-repos.sh
#./Setup-repos.sh Test
Now we have created a test project and can access it through http: // 127.0.0.1: 8099