Installing SVN-Trac on Media Temple (dv) 3.5 running on CentOS 5.3

Recently I had to move my Media Temple's (dv) server to new (dv) server. Their migration manager only migrated domain and database related datas, but not my previous installation of SVN+Trac. So, unfortunately I had no choice but to install them again. So, let's get to the point - How to install SVN & Trac on new (mt) dv-3.5 running linux CentOS 5.3

Here is what you will accomplish by following this tutorial:

  • You will access your SVN repositories using
  • You will access your Trac instances using
  • SVN repositories will reside inside /srv/svnrepos (Project location will be /srv/svnrepos/demo-project)
  • Trac instances will reside inside /srv/trac (Project location will be /srv/trac/demo-project)
  • We will use simple htpasswd based authentication system for user to access all the projects.
Ofcourse you can change the sub-domain names and paths according to your need and taste :-)

Before we begin into details of setting up, there are few house-keeping work that you have to do yourself from your Media Temple Plesk Admin Panel.

  • You must have root access to the (dv) server. View KB#625
  • You must have "Developer Tools" installed on the server. How to install Dev-Tools on (mt) - Note that, installing DT will take some time. To view list of packages included in the developer tools, view KB#807
  • Create your preferred sub-domains, in the example we have used "svn" and "trac" under primary domain "". Visit KB#910 for sub-domain creation guide.
My (dv) is running CentOS release 5.3 (Final) and 'uname -r' gives "2.6.9-023stab048.6-enterprise"
I used "nano" plain-text-editor, which is not installed by default, you need to execute "yum install nano" to use nano, else you can use "vim" if you are master at it.

Ready to roll:

Install YUM Package Manager: (follow KB#1564 - for your convenience I've copied the commands here)

# Install Python Iniparse (a new dependancy of Yum)
rpm -Uvh
# Now install Yum and Yum FastestMirror
rpm -Uvh
Next, update all the installed packages using yum:
yum -y update
Note: Parameter "-y" means assume that the answer to any question which would be asked is yes. You can remove that to verify list of packages to be updated.

Installing Latest Trac: Best way to manage Trac is to use easy_install tool provided by SetupTools. By default, (dv) 3.5 come with Python-2.4, so we need to download appropriate python egg

# Get python egg for setuptools - visit for updated file
# Verify md5 has provided by setuptools -  260a2be2e5388d66bdaee06abec6342a
md5sum setuptools-0.6c9-py2.4.egg
# Install - 'easy_install' tool
sh setuptools-0.6c9-py2.4.egg
# Finally - Install latest version of Trac (currently v0.11.5)
easy_install Trac
Note: We could have used "yum install trac" to install trac package, but it is easier to maintain Trac with "easy_install" and add/update additional plugins/modules to trac with single line of command.

We will be using Trac's Account Manager Plugin to have nice HTML login form instead of pop-up login window.
# Use this easy install command to add AccountManagerPlugin, visit plugin web for more info

Create required directories: You may change the directory name/path if you wish.

mkdir /srv/svnrepos     # Parent directory for all SVN repositories
mkdir /srv/trac         # Parent directory for all trac instances
mkdir /srv/authz        # User's global/common authentication files will be stored here
mkdir /srv/www          # Dummy place for SVN root (used inside vhost.conf for SVN)
mkdir /srv/tmpcache     # Temporary cache for PYTHON_EGG (used inside vhost.conf for Trac)
mkdir -p /srv/trac-common/conf/  # Common configs for all Trac instances

Create User Authentication and Permission: We'll be using very basic htpasswd tool to create our usernames and password for authentication to both Trac and SVN via HTTP

# Create "users.htpasswd" file which will store all username and encrypted passwords
htpasswd -cb /srv/authz/users.htpasswd user1 userpassw0rd
# To add additional users, do not use "-c" flag, you'll loose old user entries, use
htpasswd -b /srv/authz/users.htpasswd user2 user2passw0rd2

Now, we will create common config file for all the Trac instances. We need to define centralized authentication system in this config and few more additional values. For more information on trac config - visit
# Creating common conf file for trac
nano /srv/trac-common/conf/trac.ini 
Add following configs to the common trac.ini
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
trac.web.auth.loginmodule = disabled
tracspamfilter.* = disabled
password_file = /srv/authz/users.htpasswd
password_format = htpasswd
password_store = HtPasswdStore
max_size = 5242880

Create SVN Repository and Trac Instance:

# Create SVN repo
svnadmin create /srv/svnrepos/demo-project
# Create Trac Instance - use defaults and provide the svn repo location you just created above
trac-admin /srv/trac/demo-project initenv --inherit=/srv/trac-common/conf/trac.ini
# Add a user as admin who will be managing this
trac-admin /srv/trac/demo-project permission add user1 TRAC_ADMIN
# Change ownership of the files to the web-server (apache)
chown -R apache:apache /srv/svnrepos/demo-project
chown -R apache:apache /srv/trac/demo-project
# Finally, add users ID to allow access to the project's repository
nano /srv/authz/svnauth.ini
Give user permission to read and/or write to our svn repository.
# Add the following permission for user inside the "svnauth.ini" file

Add VHOST conf for both Sub-Domains: We need to add apache conf file for both sub-domains so that request to those sub-domains are properly handled.
Note: Replace following with your primary and sub-domain name.

# First add vhost.conf for our SVN subdomain
nano /var/www/vhosts/
Add the following to the vhost.conf - for subversion subdomain
  DocumentRoot /srv/www
  <Location />
    DAV svn
    SVNParentPath /srv/svnrepos
    Order allow,deny
    Allow from all
    # Authentication
    AuthType Basic
    AuthName " Subversion Repository"
    AuthUserFile /srv/authz/users.htpasswd
    Require valid-user
    # Project base authorization
    AuthzSVNAccessFile "/srv/authz/svnauth.ini"
  CustomLog /srv/logs/access.log combined
  ErrorLog /srv/logs/error.log

Now, lets update vhost.conf for Trac
# Second add vhost.conf for our Trac subdomain
nano /var/www/vhosts/
Add the following to the vhost.conf - for Trac subdomain
  # trac config for site
  DocumentRoot /srv/trac
  <Directory "/srv/trac">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    # mod_python speeds things up considerably
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnvParentDir "/srv/trac"
    PythonOption TracUriRoot "/"
    SetEnv PYTHON_EGG_CACHE /srv/tmpcache

Restart Apache and Reload all configs: You will need to do this just once. After all the vhost.conf values are loaded, you can continue creating repositories and you won't have to restart apache again.

# Use following to restart apache web server
/etc/init.d/httpd restart
# Reload all the web server configs
/usr/local/psa/admin/sbin/websrvmng -a -v
If web server restarted successfully, then you are all set. Checkout your svn repository using and you should be able to browse trac instance at

Are we done yet?
Nope! not really, but at-least you have the svn+trac accessible via HTTP method. Now it's your job to make both of them more customized and secure (if you want).
Enjoy, I'll add post-installation documents/task soon.


I followed your tutorial wich seems quit cool, but during the /usr/local/psa/admin/sbin/websrvmng -a -v command, it crashed all my apach configuration !
It seems not to be compatible !!

Don't try this at home :P

It was tested only on DV 3.5 - so check (mt)'s wiki on how to reload apache configs without rebooting system.

Hello, thanks for the tutorial. I have managed to setup SVN successfully but trac configuration isn't working! I'm following the same you did without success.

When I try to access or I get the following error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Do you have any idea why? Could you explain the configuration file? Why in SVN you use Location and with TRAC you use Directory?


Another possible reason may be because of permissions. So, make sure apache user has access to repository and trac instance.

I am having the same mysterious internal server error. I can't find anything in /srv/logs/error.log. If you find a solution, please let me know.

Internal server error is a tricky error, one can not tell anything unless you see the error log of apache for that subdomain. Similar thing happened for me, because i did not give read+write permission for trac project directory to apache-server user.

Check to log for error details. And about the subdomain configs, this is the way it worked for me, thats why I did not bother changing the values.

Let me know if you could resolve the issue. Good luck.

We wrote a similar article for the DV 3.5 servers, enjoy :

© Hossain Khan - Some rights reserved.
Creative Commons License This site is licensed under a Creative Commons Attribution-Noncommercial 2.5 License.