How to install svn for apache and svnmanager on Ubuntu

Recommended Ubuntu book

This tutorial will guide through installation of subversion on Ubuntu to work with apache, and then installing svnmanager. Svnmanager is a handy tool that lets you manage the users and repositories through the web interface. Before we begin, make sure you have a lamp server setup on Ubuntu.

First, lets install subversion and apache library:

sudo apt-get install subversion libapache2-svn

Lets create the directories in which svn repositories and configurations will reside and give apache access to them:

cd /srv
sudo mkdir svn
sudo mkdir svnconfig
cd svn
sudo mkdir repos
sudo chown -R www-data.www-data /srv/svnconfig /srv/svn

Next, we need to set up apache and allow access to subversion repository:

sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

Uncomment the lines like below, file names will be created at a later stage by svnmanager:


# Uncomment this to enable the repository
DAV svn

# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /srv/svn/repos

# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /srv/svn/htpasswd

# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
Require valid-user

# To enable authorization via mod_authz_svn
AuthzSVNAccessFile /srv/svn/accessfile


Lets restart Apache:

sudo /etc/init.d/apache2 restart

Now lets create a new user in MySql for svnmanager. Get to mysql client using this command:

sudo mysql -u root -p

Type in your password and execute this mysql command:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER on svnmanager.* to svnmanager identified by 'password';

Where password should be replaced by your password.

Next, if you followed my tutorial on installing lamp, you may need to add php-pear as it was not added previously. Got to the terminal and type:

sudo apt-get install php-pear

Next, lets install the pear VersionControl_SVN module, type:

sudo pear install -f -o VersionControl_SVN

Now we are ready to install SVNManager. Download the latest package, I’ll get mine from, at the time of writing the latest is 1.08. The file itself is at I am going to download the tar.gz one in my Apache web directory which is /var/www/ :

cd /var/www/
sudo wget

Now lets untar (Ubuntu tar tutorial) it:

sudo tar xzf svnmanager-1.08.tar.gz

I will rename the folder for convenience:

sudo mv svnmanager-1.08 svnmanager

Now the fun part, lets copy and open the configuration file:

cd svnmanager
sudo cp config.php.linux config.php
sudo gedit config.php

Here you can start changing the language and htpasswd locations if you need. Since I have default installation and everything seems correct, I move to the next lines for svn locations:

$svn_config_dir = "/srv/svnconfig";
$svn_repos_loc = "/srv/svn/repos";
$svn_passwd_file = "/srv/svn/htpasswd";
$svn_access_file = "/srv/svn/accessfile";
$svn_trash_loc = "/srv/svn/trash";

Now if you have smtp server, you need to specify it in order for email notifications to function, which is a pretty nice feature in svnmanger. To intall smtp server just for the sake of experiment, you can just type ‘sudo apt-get install postfix’ and leave it with no configuration option. You can reconfigure it later with ‘sudo dpkg-reconfigure postfix’.

$smtp_server = "yoursmatpserverurl";

Next, database configuration, replace ‘yourpassword’ with password you made for svnmanager user:

$dsn = "mysqli://svnmanager:yourpassword@localhost/svnmanager";

Now save the file and restart Apache:

sudo /etc/init.d/apache2 restart

Go to http://localhost/svnmanager/ and you should see the message that the tables have been created. Reload the page and login with ‘admin’ ‘admin’, which we left untouched in the configuration file. Don’t worry, once you login and create admin user, config credentials will not work. Go to create your new user, set him as admin and type ‘admin’ in the lowest ‘password’ box, which is your current default password.

You are now set with SVNManager, which, I believe, significantly helps to manage multiple users and repositories.

Phew, took me forever to write this post as I was installing svn and svnmanager at the same time. Please let me know how it works for you. 🙂

Update: once you create a repository, try to access it in browser at http://localhost/svn/your_repository_name/ . If it shows 500 Internal Server Error, you may have to go back and edit /etc/apache2/mods-available/dav_svn.conf and change the line AuthUserFile to:

AuthUserFile /srv/svn/passwdfile

since the file htpasswd may not exist and cause this error to happen. Just checked my apache logs and this was the problem.


Another update: I did a postfix install on Ubuntu to send mail and updates to repositories to the needed users (handy feature). However, I had problems with svnmanager sending the mail. I checked my /var/log/mail.log and was getting:

Aug 26 13:02:00 my-ubuntu postfix/smtpd[13809]: connect from localhost[]
Aug 26 13:02:00 my-ubuntu postfix/smtpd[13809]: warning: Illegal address syntax from localhost[] in MAIL command: 
Aug 26 13:02:00 my-ubuntu postfix/smtpd[13809]: lost connection after RSET from localhost[]
Aug 26 13:02:00 my-ubuntu postfix/smtpd[13809]: disconnect from localhost[]

The problem seemed to be that my hostname was an ip address, which needs to be in square brackets like svnmanager@[]. Then I edited the mail functionality:

/var/www/svnmanager/svnmanager/UserModule$ sudo gedit InvitePage.php

where you can edit $mail->From = “svnmanager@[$servername]”; by adding those square brackets. Also, you can edit the $message if needed.
Also, may need to edit InviteManagePage.php in the same folder to suit your needs.

13 Responses to “How to install svn for apache and svnmanager on Ubuntu

  • 1
    Ubuntu How To » How to install postfix to relay mail through gmail in Ubuntu
    August 26th, 2011 20:36

    […] How To Use Ubuntu, Starting From Lucid Lynx « How to install svn for apache and svnmanager on Ubuntu […]

  • 2
    December 28th, 2011 19:56

    I can’t browse (403 Forbidden) repos when I will enable authorization via mod_authz_svn. When I use regular httpasswd I’m able to browse repos. Any clue? Thanks

  • 3
    John Ka
    January 4th, 2012 09:09

    Hello and thanks for this nice tutorial.
    I have followed it to the tee and it is mostly all working. The only problem I have is that through SVN Manager web interface when I try to “Change User Privileges of a Repository” as soon as I select the repository I’d like to make changes to I receive the following error.

    Fatal Error

    [2] require_once(VersionControl/SVN.php): failed to open stream: No such file or directory (@line 201 in file /var/www/svnmanager/svnmanager/RepositoryModule/UserPrivilegesEditPage.php).
    Debug Backtrace

    #1 UserPrivilegesEditPage.php:201 — pradoErrorHandler(…)
    #2 UserPrivilegesEditPage.php:201 — UserPrivilegesEditPage::onLoad()
    #3 TControl.php:419 — UserPrivilegesEditPage->onLoad(…)
    #4 TPage.php:1079 — TControl->onLoadRecursive(…)
    #5 TPage.php:955 — TPage->onLoadRecursive(…)
    #6 TApplication.php:483 — TPage->execute()
    #7 index.php:5 — TApplication->run()

    Same happens when I try to “Change Group Privileges of a Repository”. Everything else sofar seems to be working ok. I know it’s been a while since you’ve posted this but if you can shed some light on this problem that would be great.



  • 4
    February 17th, 2012 15:50

    THANK YOU!!!!! i was struggling with the last part using the install guide on svnmanager…

  • 5
    February 18th, 2012 02:03

    No problem, glad I could help.

  • 6
    February 18th, 2012 02:08

    @John, do you have a complete code for svn? Looks like some php files are missing, can’t really tell without looking at the install.

  • 7
    June 11th, 2012 23:22

    Is there a good way to backup both svn and svnmanager files, for future restore??

  • 8
    July 22nd, 2012 12:01

    Check your directory in share/pear
    I has VersionControl_SVN, so i needed simple symlink VersionControl -> VersionControl_SVN/

  • 9
    August 31st, 2012 20:25

    @John, please sure what you didnt foget that step: sudo apt-get install php-pear
    I had the same msg and solution was reinstall php-pear

  • 10
    September 26th, 2012 00:57

    @Si and @podonok, thanks for the help, looks like you guys got this issue sorted out now.

  • 11
    September 26th, 2012 00:58

    @Jen, I would have to look into this and perhaps write another post on the subject as it may need some investigation work on my part.

  • 12
    Thin Pyai
    December 15th, 2016 12:51

    When I select repository at Group Privileges of Repository Admin.

    On the browser, the following error is shown

    VersionControl_SVN_Exception: “svn_path” is not a valid option
    #0 /usr/share/php/VersionControl/SVN.php(267): VersionControl_SVN_Command->setOptions(Array)
    #1 /usr/share/php/VersionControl/SVN.php(226): VersionControl_SVN::init(‘list’, Array)
    #2 /var/www/html/svnmanager/RepositoryModule/GroupPrivilegesEditPage.php(214): VersionControl_SVN::factory(Array, Array)
    #3 /var/www/html/prado-2.0.3/framework/Web/UI/TControl.php(419): GroupPrivilegesEditPage->onLoad(Object(TEventParameter))
    #4 /var/www/html/prado-2.0.3/framework/Web/UI/TPage.php(1079): TControl->onLoadRecursive(Object(TEventParameter))
    #5 /var/www/html/prado-2.0.3/framework/Web/UI/TPage.php(955): TPage->onLoadRecursive(Object(TEventParameter))
    #6 /var/www/html/prado-2.0.3/framework/TApplication.php(483): TPage->execute()
    #7 /var/www/html/index.php(5): TApplication->run()
    #8 {main}

  • 13
    December 28th, 2016 23:55

    @Thin Pyai
    I think the issue is with the latest SVNManager, try changing files UserPrivilegesEditPage.php and GroupPrivilegesEditPage.php as following:

    $options = array(‘fetchmode’ => VERSIONCONTROL_SVN_FETCHMODE_ARRAY, ‘svn_path’ => $svn_cmd);

    $options = array(‘fetchmode’ => VERSIONCONTROL_SVN_FETCHMODE_ARRAY);