This article should describe how to install and setup a SVN server on Linux Debian Lenny. The instructions may also work for other Linux distributions like Ubuntu, Fedora, RedHat and Open Suse.
1. Install the packages necessary for the SVN server
apt-get install php-pear libapache2-svn subversion
pear install -f -o VersionControl_SVN
Setup the repository root directory.
mkdir -p /var/lib/svn/repos
touch /var/lib/svn/htpasswd
touch /var/lib/svn/accessfile
chown -R www-data:www-data /var/lib/svn
2. Configurate the dav_svn module in Apache2
nano /etc/apache2/mods-available/dav_svn.conf
Add the following lines or make sure they are not commented (no leading #). There might be more content between the location tags but below are the values that have to be there with those values.
<Location /svn>
DAV svn
SVNParentPath /var/lib/svn/repos
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /var/lib/svn/htpasswd
# SSLRequireSSL
AuthzSVNAccessFile /var/lib/svn/accessfile
Require valid-user
</Location>
3. Download SVNManager and setup
Change into the folder for the apache server pages. By default that is /var/www.
cd /var/www
Create the folder for the svnmanager and download the svnmanager file there. Check on
svnmanager.org for the current version and right click on the download link and copy the link address.
mkdir svnmanger
wget http://prdownloads.sourceforge.net/svnmanager/svnmanager-1.08.tar.gz
After the download is done extract the archive and copy the files into the "nice folder".
tar xvfz svnmanager-1.xx.tar.gz
cp -R svnmanager-1.xx/* /var/www/svnmanager
Enable the default linux config file.
cd /var/www/svnmanager
cp config.php.linux config.php
Enable the dav_svn module for apache2.
a2enmod dav_svn
invoke-rc.d apache2 restart
4. Edit the config.php
nano config.php
Change the lines to following values.
<?php
//Shell command’s
$htpassword_cmd = “/usr/bin/htpasswd”;
$svn_cmd = “/usr/bin/svn”;
$svnadmin_cmd = “/usr/bin/svnadmin”;
//Subversion
$svn_repos_loc = “/var/lib/svn/repos”;
$svn_passwd_file= “/var/lib/svn/htpasswd”;
$svn_access_file= “/var/lib/svn/accessfile”;
//SMTP Server
$smtp_server = “localhost”;
//Database
$dsn =”mysqli://svnmanager:password@localhost/svnmanager”;
//Administrator account
$admin_name=”admin”;
$admin_temp_password=”admin”;
5. Create Databases and User Account
If you have phpmyadmin installed (e.g. via ttp://your-ip/phpmyadmin) you can create a new database there called svnmanager. Also create a user (e.g. svnuser) with password and grant select, insert, update, delete, create, drop, alter rights.
If you don't have phpmyadmin run following commands:
mysql -u root -p -e”CREATE DATABASE svnmanager; \
GRANT select, insert, update, delete, create, drop, alter on svnmanager.* to ’svnmanager’@'localhost’ identified by ‘password’; \
FLUSH PRIVILEGES;
6. Create admin user in SVN Manager and create repository and grant access
With the Administrator account configured in the config.php login to your svnmanager at http://your-IP/svnmanager. Create a new user with administrator rights there. Because for security reasons you can not use the initial administrator account to create repositories and users.
So log out and login with the new admin user and setup repositories users and privileges.
Repositories created via SVNManager look like:
http://your-ip/svn/repository-name
7. Troubleshooting for Linux Debian Lenny
For Linux Debian Lenny following bug is known. A locale setting problem can occur if en_US.UTF-8 is not used. This can be fixed with the following steps.
apt-get install locales
export LC_ALL=en_US.UTF-8
dpkg-reconfigure locales (run the command and select en_US.UTF-8 as default)
reboot