This tutorial will guide you through installation of Apache, HTTPS, Subversion and Trac, in order to have an (almost) complete development environment for your team.

This article is divided in following steps

1. Installing Subversion
2. Installing Apache
3. Configuring Apache with SSL
4. Configuring Subversion with Apache (and SSL)
5. Installing Trac

You may choose for example to see how to install Apache and SSL, or having Apache plus subversion without Trac.
Steps are voluntary isolated, and will require more operations than, for instance, issuing an "apt-get install trac" that will download and install all the packages in one step; but this will hopefully allow the readers to choose picking one section and forget about unneeded components.
I'll not explain what Subversion is, or what SSL is, etc. Ask google, for this info: I just say that for your software project you may need a server with those tools ready for your team.


You need Ubuntu 9.04, in my case I used the "server edition" 64bit, while installing I used the minimal server mode pressing F4 to have a system as lighter as possible. But possibly this tutorial should be valid for Debian and previous Ubuntu version; but I have not verified that: if you do, post a comment to report your experience.


After installing your server you have to ensure that apt system is up to date with available software on the repositories. Type the following command:

$ sudo apt-get update

upgrading installed packages may be a good idea to do now:

$ sudo apt-get upgrade

Answer Yes if asked to download and install the upgrades.

1. Installing Subversion

From the command line type the command:

$ sudo apt-get install subversion

If everything went fine you should able to verify the Subversion version installed with following command:

$ svn --version
svn, version 1.5.4 (r33841)
   compiled Aug  7 2009, 02:02:06

Copyright (C) 2000-2008 CollabNet.
Subversion is open source software, see
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

For now, let's stop here: how to create the Subversion repository, configure the users etc. Will be explained later in conjunction with Apache2 configuration. Maybe I'll write something on how to deal with svnserve, svnadmin, and user access control, in another article.

Later we will see how to create a repository, configure it with apache and HTTP basic authentication.

2. Installing Apache

To install apache 2 type the command:

$ sudo apt-get install apache2

When finished you should be able to connect with the browser at http://localhost and see the message "It works!". Or you may verify that at the command line installing and using curl:

$ sudo apt-get install curl 
$ curl http://localhost
<html><body><h1>It works!</h1></body></html>

3. Configuring Apache with SSL

Now we want to configure apache to run HTTPs.
Following command will enable ssl Apache2 module with a2enmod (cryptic name for "Apache2 enable module":

$ sudo a2enmod ssl

The previous command will suggest you to restart apache to let it to reload the configuration; ignore that message for now.

We need to enable the HTTPS port (443). Edit /etc/apache2/ports.conf and ensure that port 443 is defined as follows:

$ sudo vi /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    NameVirtualHost *:443
    Listen 443

I added the clause NameVirtualHost *:443 in the for SSL; this is not strictly necessary but it will be useful later if you want to have a VirtualHost for trac and other development services.

Now we need to configure the SSL site. Fortunately we have already the configuration file for that, we just need to enable it with a2ensite (cryptic name for "apache2 enable site")

$ sudo a2ensite default-ssl

Again, the above command will suggest to reload apache configuration to activate the changes. This time the suggestion is almost right. As we made several changes I prefer to restart apache with following command:

$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2                                                                                              apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName

If everything went fine you should see the above warning. You can ignore it, unless you want to configure the ServerName for your server. But this is out of scope, so do a search on Google, or consult an Apache expert.

So, if everything went fine, now we should be able to connect to our server through SSL.
You can use firefox or curl, as before, but this time the URL will be https://localhost

$ curl -k https://localhost
<html><body><h1>It works!</h1></body></html>

the -k option is to ignore certification validation. Also firefox will complain that our certificate is invalid, but you can add it to exceptions and it will nomore bug you with those messages.

If everything went fine, now we should have Apache2, HTTP and HTTPs ready.

4. Configuring Subversion with Apache (and SSL)

First of all, we need to install the Subversion modules for Apache2.

$ sudo apt-get install libapache2-svn

They will be enabled by default. So you don't need to run a2enmod.

We only need to configure a repository. Let' say our project is called 'myproject'.

First of all, let's decide where our svn repositories will be created. I like /var/local/svn :

$ sudo mkdir /var/local/svn

Then let's create the repository using following procedure:

$ sudo mkdir /var/local/svn/myproject
$ sudo chown www-data:www-data /var/local/svn/myproject
$ sudo -u www-data svnadmin create /var/local/svn/myproject

Above commands will ensure that the user www-data (which is the apache user) can fully access the repository for reading and updating it.

We need to configure the repository in Apache. Edit /etc/apache2/mods-available/dav_svn.conf using:

$ sudo vi /etc/apache2/mods-available/dav_svn.conf

And add a section like the following one:

<Location /svn/myproject>
  DAV svn
  SVNPath /var/local/svn/myproject
  AuthType Basic
  AuthName "My Project Subversion Repository"
  AuthUserFile /etc/subversion/myproject.passwd
    Require valid-user

In the above file we indicated that, at the location svn our repository should respond. And for updating the repository we want a valid user. As per above configuration anonymous consultation is allowed; but you can disable it commenting with a leading '#' the lines <LimitExcept ... and </LimitExcept> or just removing them as in following example:

<Location /svn/myproject>
  DAV svn
  SVNPath /var/local/svn/myproject
  AuthType Basic
  AuthName "My Project Subversion Repository"
  AuthUserFile /etc/subversion/myproject.passwd
    Require valid-user

The above configuration indicates to Apache that even for consulting the repository we want a valid user.
But valid users need a password, and in fact we indicated a password file for our repository called /etc/subversion/myproject.passwd. So let's create a password file with a couple of users:

$ sudo htpasswd -c /etc/subversion/myproject.passwd luigi
$ sudo htpasswd /etc/subversion/myproject.passwd mario

The -c option indicates that the password file should be created as new; and it is only necessary for the first user. Be aware of the fact that -c overwrites the existing password file without asking anything. Personally I think this is a quite stupid behavior, but that's the way it is.

Now we should be ready.

Let's reload apache configuration to make the changes effective:

$ sudo /etc/init.d/apache2 reload

and let's test with the browser that our svn repository is now accessible through HTTP and HTTPs at following urls:



We can also use curl to verify it is working:

$ curl http://username:password@localhost/svn/myproject/
<html><head><title>myproject - Revision 0: /</title></head>
 <h2>myproject - Revision 0: /</h2>
 <hr noshade><em>Powered by <a href="">Subversion</a> version 1.5.4 (r33841).</em>
$ curl -k https://username:password@localhost/svn/myproject/ 
<html><head><title>myproject - Revision 0: /</title></head>
 <h2>myproject - Revision 0: /</h2>
 <hr noshade><em>Powered by <a href="">Subversion</a> version 1.5.4 (r33841).</em>

Now we can also download our project using svn

$ svn co https://localhost/svn/myproject myproject --username luigi

"luigi" is obviously my username, substitute it with yours.
The first time it will prompt for accepting the SSL certificate, answer to accept it permanently (p). Then it will optionally ask you for the password, type it.
We can also test that modifying the remote repository is working with:

$ svn mkdir -m "created the trunk for the project" https://localhost/svn/myproject/trunk --username luigi

It will answer: Committed revision 1. If so, we've done.

5. Installing Trac

To install trac files and required dependencies, type the following command:

$ sudo apt-get install trac
$ sudo apt-get install libapache2-mod-python

Let's create the directories for trac web folder:

$ sudo mkdir /var/local/trac
$ sudo chown www-data:www-data /var/local/trac

edit Apache configuration file for one of your enabled sites (in this example I modify the default http one, but you can choose to put trac on HTTPS modifying default-ssl)

$ sudo vi /etc/apache2/sites-enabled/000-default

and add the following lines at the end of the file, before the </VirtualHost> tag:

        <Location /projects>
                SetHandler mod_python
                PythonInterpreter main_interpreter
                PythonHandler trac.web.modpython_frontend
                PythonOption TracEnvParentDir /var/local/trac
                PythonOption TracUriRoot /projects
                PythonOption PYTHON_EGG_CACHE /tmp

        # use the following for one authorization for all projects 
        # (names containing "-" are not detected):
        <LocationMatch "/projects/[[:alnum:]]+/login">
            AuthType Basic
            AuthName "trac"
            AuthUserFile /etc/trac/trac.passwd
            Require valid-user

Create a password file for trac users (if you want you can reuse or link the passwd file used for subversion repositories)

$ sudo htpasswd -c /etc/trac/trac.passwd luigi
$ sudo htpasswd  /etc/trac/trac.passwd mario
... continue this way for all your users.

Create the trac environment for your project:

$ sudo -u www-data trac-admin /var/local/trac/myproject initenv

It will ask you some questions related to your project. Here's my answers in blue

Project Name [My Project]> My Project
Database connection string [sqlite:db/trac.db]> [Just press Enter to accept the default]
Repository type [svn]>  [Just press Enter to accept the default]
Path to repository [/path/to/repos]> /var/local/svn/myproject

Now let's restart apache:

$ sudo /etc/init.d/apache2 restart

Check that trac works properly connecting the browser to http://localhost/projects or use curl to verify that the url is responding properly as we did before. This url should display a link to "My Project", click on it and you should see the project home page. Clicking on login the browser should ask you to provide username and password as recently defined with htpasswd command.

Last thing to do: add yourself as administrator for Trac. This will enable the Admin menu and allow to do much of the administration operations from the web, that you could also do at the command line with trac-admin tool.
Execute the following command:

$ sudo -u www-data trac-admin /var/local/trac/myproject permission add luigi TRAC_ADMIN

This will make the username 'luigi' administrator for the project.

You can tune additional configuration settings in Trac to enable email notification, change the project logo, etc. Everything you need to know is on Trac website. For the configuration check here:

Hope everything went fine. Enjoy your development!

53 Responses to “Install Tutorial: Ubuntu 9.04, Apache with SSL, Subversion over HTTP / HTTPs, and Trac”  

  1. 1 Prabakaran K

    Great Work Mate!! Keep up the work.. It saved ma whole day !! Thanks a lot

  2. 2 venkat

    Dear Luigi,
    excellent work . i am trying for this kind of solution from last two weeks. now i got from this blog. thank you very much Luigi

  3. 3 Luigi

    You welcome! Nice to hear it has been useful.

  4. 4 James Cain

    Great job. Helped me kick start my project.

  5. 5 venkat

    Dear Luigi,

    I have a question…. I am trying to use svnserve through remote machine….. but i am getting Problem in that ….. if u know please help me….

    I gave the following command to commit….. for checkout its works completed successfully
    sudo svn commit -m “testting directory” –username mario

    i getting following eorror

    [sudo] password for somepalli:
    svn: Commit failed (details follow):
    svn: Authorization failed

    Thank you in advance

  6. 6 Luigi

    Hi venkat,

    svnserve uses authz file: check it in your repository/conf/authz and passwd.

  7. 7 venkat

    means here u created a file myproject.passwd for svn. This file is not going to be useful for svnserve. it is only for svn authentication i guess. am i sure?….. svn user and password are different from svnserve user and password…. am i correct?

  8. 8 Luigi

    Yes, the file myproject.passwd is for the apache basic authentication. it is valid only for apache.
    Svnserve instead uses those text files to configure access control over the repository.

    You can configure apache for using the authz system of svnserve, so it is possible to have the users and the authorizations in a single file having them shared between http and svn protocol. But in most of the cases people using http do not need svnserve, and http basic authentication is enough.

    If you want to configure apache authorization to use authz, which is the file format used by svnserve, search for mod_authz_svn on google or on . It shouldn’t be hard to set up.

  9. 9 Russell

    Great article, thanks very much for taking the time to write it.

    I changed

    to handle dashes/underscores/etc in project directory names. I’m not sure the “.” is really needed, but I put it there to prevent matching “/projects/../login” just in case that location exists with some different auth method.

  10. 10 Russell

    Oops, I see that the apache configuration tags were stripped from my original comment. With out the angle brackets this time, I changed:

    LocationMatch “/projects/[[:alnum:]]+/login”

    to: LocationMatch “/projects/[^/.]+/login”

    Thanks again!

  11. 11 venkat

    Thank you very much Luigi

  12. 12 Pradeep

    Thanks just the thing I was looking for..

  13. 13 Karlisson

    Hey! Nice tutorial! You forgot to make the symbolic link:

    sudo ln -s /etc/apache2/mods-available/dav_svn.conf /etc/apache2/mods-enabled/dav_svn.conf

  14. 14 Luigi

    I didn’t made any link. possibly because on ubuntu once you install dav_svn module it gets enabled by default, I don’t remember now… or doing a2enmod it will make the links for you

  15. 15 Adam

    When reaching the last step in the “Configuring Subversion with Apache (and SSL)” section and running the command:

    svn mkdir -m “created the trunk for the project” https://localhost/

    The directory is not created and I received the message:

    svn: /build/buildd/subversion-1.5.4dfsg1/subversion/libsvn_subr/path.c:119: svn_path_join: Assertion `is_canonical(base, blen)’ failed.

    Any suggestions?

  16. 16 recos

    thank you so much. you been great help.
    it was easy to read and follow.
    maybe thebestt tutorial for this
    keep up the good work!

  17. 17 Jaime

    Thanks a lot for this great tutorial, everything worked perfectly!

  18. 18 DomGer

    Very good explainings of the seperate steps!
    Works great -
    Good work, Luigi!

  19. 19 hoss

    Great instructions! Couple of things I ran into…

    Following the instructions install 11.1 for me, even in trac IRC channel, they said there are known issues with 11.1 and 9.04 Ubuntu that have since been fixed. I simply ran the below, then rebooted and bam, I had working 11.5.

    easy_install --upgrade Trac

    Now, a couple questions I hope I can get help with…
    1) HTTP works fine. But HTTPS only seems to work for the “It works!” page (http://localhost). But when I try to get to any trac pages, I get file not found. Same URL but with HTTP instead works fine. Also, SVN over HTTPS is workign fine too.

    2) Once I get the above resovled, I would like to turn off HTTP access, how do I do this?


  20. 20 Luigi

    Hi hoss.

    I have no issues related to the trac provided with ubuntu 9.04. what kind of issue were they talking about on IRC?

    for https, you have to configure it for running with svn, see step 4. Running trac should also be possible moving the trac related apache configuration into the https configuration (/etc/apache2/sites-enabled/000-default file).

  21. 21 hoss

    Wow, thanks for fast reply!

    Ah you know what? After looking at your reply, I realized its fine, I don’t need trac to run in HTTPS, just SVN, which is how its working as is from your tutorial.

    But, I still wonder, how can I turn off HTTP for SVN? I would like SVN to work only with HTTPS.

    As for bugs with 11.1, I don’t know. I went to the trac channel on IRC with a couple questions about trac and mentioned I followed this tutorial and it installed 11.1, a couple of them commented that there were bugs in 11.1 on 9.04 that have since been addressed and recommended I get 11.5. But don’t know what the issues were.

    Sorry if I’m a bother, I’m total linux/trac noob.

  22. 22 Luigi

    At the moment I don’t know how to disable http for subversion, I think it should be enough to move the configuration from /etc/apache2/mods-available/dav_svn.conf into the /etc/apache2/sites-enabled/default-ssl , so that those directives would be valid only for the https. But… I think it’s always useful to allow user to connect also with HTTP, sometimes you cannot exit the firewall other than on http which is the most ubiquitous protocol available. Also http is good if you want to keep on subversion a repository for your artifacts which could be a good idea to keep under version control. Good luck.

  23. 23 Mark

    Just to say thanks for the tutorial, it was easy to follow and managed to get everything working more or less first time.

  24. 24 Dev

    Hi Luigi,

    Can I have a tutorial on subversion client installation in Linux Ubuntu…


  25. 25 Nick

    this is a great combination! i’m glad to have found this tutorial, there’s bits and pieces online but you’ve managed to sum it all up here. good job :)

  26. 26 Hanu

    after this this command

    $ sudo -u www-data svnadmin create /var/local/svn/myproject

    I got following message.

    svnadmin: Can’t open file ‘/home/show/.subversion/servers’: Permission denied

    How to resolve this?

  27. 27 Hanu

    the above message i got in Ubuntu 9.10

  28. 28 Luigi

    Hi Hanu. Check file permissions and owner of the files in /home/show/.subversion

  29. 29 Hanu

    thank you

  30. 30 Rayford Rabey

    This article is in reality the most informative on this worthwhile topic. I agree with your opinion and will eagerly look forward to your next updates. Just saying thanks will not just be adequate, for the exceptional clarity in your writing. I will surely favorite your rss feed to stay informed of any updates. Good work and much success in your business enterprise!

  31. 31 Clinton Papenfus


    Thank you for a great tutoria. I have installed on 9.10, no problems. I think you must change your title to
    Install Tutorial: Ubuntu 9.04 & 9.10, Apache with SSL, Subversion over HTTP / HTTPs, and Trac

  32. 32 Gary Mui

    Thanks for the very clear tutorial. I didn’t install Trac since I’m going to use the $10 Fisheye license. But this worked very easily for me (on Ubuntu 9.10).

  33. 33 sundaram

    Hi Luigi,

    I was reading your write-up on ‘how to install Trac’ and found it quite detailed and useful. I also would like to know the following;
    –Do I need MySql and in that case can you pl update the tutorial adding the the steps for doing so;
    –can the local host be accessed from another client through the ‘internet’ and to do so does it require an IP address/?

    Thank you,


  34. 34 Luigi

    I didn’t write anything about mysql. I don’t remember for sure, but I think you don’t need it.

  35. 35 Roger

    Hey Luigi,

    you truly rock – that’s exactly the missing tutorial for the setup i needed. I have a ubuntu karmic 9.4 setup and your tutorial works out of the box – you saved me hours dude. I am so happy – i will agilo to trac and project can be started ;)

    thanks for this tutorial!

    all the best

  36. 36 Gias

    Hi Luigi,

    Thanks for this great tutorial. I have installed this successfully in Ubuntu 9.10. I don’t know if you could help on this or not – how can I install macros for Trac? For example, I have tried to follow guidances in ‘’ to install However, I was not successful. The wiki page complains that the corresponding macro was not found.


  37. 37 fadoua

    Hi Luigi,

    Thank you very much for this great tutorial.

  38. 38 Tena

    Absolutely amazing,it worked like a charm, thank you so so so sooo much Luigi, you are the greatest!

  39. 39 Rajesh

    Heartfelt Thanks to Luigi for this Doc..!!!!!!

  40. 40 Besim

    Traceback (most recent call last):
    File “/usr/lib/python2.6/dist-packages/trac/web/”, line 376, in send_error
    File “/usr/lib/python2.6/dist-packages/trac/web/”, line 739, in render_template
    data = self.populate_data(req, data)
    File “/usr/lib/python2.6/dist-packages/trac/web/”, line 639, in populate_data
    File “/usr/lib/python2.6/dist-packages/trac/web/”, line 195, in __getattr__
    value = self.callbacks[name](self)
    File “/usr/lib/python2.6/dist-packages/trac/web/”, line 494, in prepare_request
    for category, name, text in contributor.get_navigation_items(req):
    File “/usr/lib/python2.6/dist-packages/trac/ticket/”, line 163, in get_navigation_items
    if ‘TICKET_CREATE’ in req.perm:
    File “/usr/lib/python2.6/dist-packages/trac/”, line 549, in has_permission
    return self._has_permission(action, resource)
    File “/usr/lib/python2.6/dist-packages/trac/”, line 563, in _has_permission
    check_permission(action, perm.username, resource, perm)
    File “/usr/lib/python2.6/dist-packages/trac/”, line 450, in check_permission
    File “/usr/lib/python2.6/dist-packages/trac/”, line 285, in check_permission
    File “/usr/lib/python2.6/dist-packages/trac/”, line 369, in get_user_permissions
    for perm in
    File “/usr/lib/python2.6/dist-packages/trac/”, line 176, in get_user_permissions
    db = self.env.get_db_cnx()
    File “/usr/lib/python2.6/dist-packages/trac/”, line 285, in get_db_cnx
    return DatabaseManager(self).get_connection()
    File “/usr/lib/python2.6/dist-packages/trac/db/”, line 92, in get_connection
    return self._cnx_pool.get_cnx(self.timeout or None)
    File “/usr/lib/python2.6/dist-packages/trac/db/”, line 176, in get_cnx
    return _backend.get_cnx(self._connector, self._kwargs, timeout)
    File “/usr/lib/python2.6/dist-packages/trac/db/”, line 109, in get_cnx
    cnx = connector.get_connection(**kwargs)
    File “/usr/lib/python2.6/dist-packages/trac/db/”, line 190, in get_connection
    return SQLiteConnection(path, log, params)
    File “/usr/lib/python2.6/dist-packages/trac/db/”, line 245, in __init__
    % (getuser(), path))
    TracError: The user cimi requires read _and_ write permissions to the database file /var/local/trac/dona/db/trac.db and the directory it is located in.

  41. 41 kannan

    hi luigi ,

    very nice article and tks a lot -_-

  42. 42 baobaz

    Thank you very much.. your tutorial is very helpfull :)

  43. 43 boby

    Hai luigi,
    This is very useful for me to setup svn server. I setup subcommander svn GUI client in client PC’s. I have 2 users boby and user2. I setup server on boby pc and also setup subcommander client in boby pc. Boby can commit but the user2 on other pc can’t can you explain how to give authentication to other users. Thanks in advance. I am using ubuntu OS.

  44. 44 women tattoos

    Thanks in advance. I am using ubuntu OS.Boby can commit but the user2 on other pc can’t can you explain how to give authentication to other users.

  45. 45 faith

    hi luigi
    i did chmod on the servers file n .subversion directory until it has full access permissions
    but the error message still popped out..
    any suggestion???

  46. 46 Nizam

    Hi luigi,
    That was a great article. I’ve followed your steps. But, I’m facing a new problem when I create a new folder in the repository. I’m not able to create it. I’ve followed the commands.

    root@nizam-desktop:/var/local/svn/myproject# mkdir samp
    root@nizam-desktop:/var/local/svn/myproject# svn add samp
    svn: ‘.’ is not a working copy

    I want this folders samp to be checked out using Rapid SVN. Where did I went wrong?

  47. 47 techgane

    Thanks for sharing a nice article

    how to install svn on ubuntu

  48. 48 fauch

    Very good tutorial.
    Thanks again.

  1. 1 svn +webdav +apache con ssl, cliente tortoise windows « Blog | Maximiliano Paolini
  2. 2 Confluence: Cyber Security
  3. 3 Instalasi server SVN dan TRAC « Buku Saku Arya
  4. 4 install svn server di ubuntu 9.10 « HaPe
  5. 5 Tutorial: Apache, Subversion por HTTP y HTTPS y Trac en Ubuntu 11.04 | Clic que te clic

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *


August 2009
« Jul   Sep »

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:



Tag Cloud