Installing SVN & Trac on a Plesk host

Process I followed to install subversion and make it available via mod dav svn on a plesk host.

Some notes incase I need to do it again:

  • create new domain in plesk to host my svn + trac install. chose php safe mode.
  • setup ftp

install svn

  • as
    root on the server install subversion and subversion-tools (using
    debian: apt-get install subversion subversion-tools libapache2-svn)
  • as root create a new svn repo in the sites directory (ie: the one above httpdocs/)
    # cd /var/www/vhosts/
    # mkdir svn
    # svnadmin create svn/myproject
  • enable mod dav:
    # a2enmod dav 
    # a2enmod dav_svn
    # /etc/init.d/apache2 restart
  • time to edit the apache config for this site
    add the below to /var/www/vhosts/
             <Location /svn>
                     DAV svn
                     SVNParentPath /var/www/vhosts/
                     AuthType Basic
                     AuthName "SVN"
                     AuthUserFile /var/www/vhosts/
                     Require valid-user
  • Create the htpassword:
    # htpasswd -c /var/www/vhosts/ username
  • Update plesk to install your vhost.conf file
    #  /usr/local/psa/admin/sbin/websrvmng -u
  • Now
    you should be right with svn, visit, enter your
    username/password and you should see a list of your repositories.

install trac

  • download trac to server wget
  • tar zxvf Trac-0.11.tar.gz
    cd Trac-0.11
    less INSTALL << read it
  • apt-get install python python-genshi python-sqlite libapache2-mod-python python-setuptools
  • a2enmod mod_python
    /etc/init.d/apache2 restart
  • run the trac installer, tell it the path to your svn repo above
  • python ./ install 
    trac-admin /var/www/vhost/ initenv
  • chown www-data: /var/www/vhost/ -R
  • vi conf/vhost.conf
    add these:
    <Location /trac/myproject>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnv /var/www/vhosts/
    PythonOption TracUriRoot /trac/myproject
    <Location /trac/myproject/login>
    AuthType Basic
    AuthName "trac"
    AuthUserFile /var/www/vhosts/
    Require valid-user
  • apt-get install python-subversion
    /etc/init.d/apache2 force-reload
  • now hit and  you should see it! woot!

configure trac

  • as root: 
    # trac-admin /var/www/vhosts/ permission add myusername TRAC_ADMIN
  • the
    above will give you a new “ADMIN” tab in the trac environment, so you
    can use the web based system to control settings instead of

svn stuff

  • you need to import you code into svn initially, like this:
    # cd /path/to/my/code/
    # svn import -m “initial import”
        enter username/password for svn and away it goes
  • after
    you have imported your code into svn, you have to “check out” a copy of
    the code again in order to work on it and have svn manage everything.
  • two ways to get code out of svn, “check out” and “export.
  • you use “check out” when you want to modify code and check it back in to svn.
  • you use “export” when you want to grab a copy of the code to for example deploy on a server
  • like this:
    # cd /path/to/where/i/want/to/edit/code
    # svn co
  • code will be checked out into a folder called “project_name” in the current directory.
  • if you look in there you will see a bunch of .svn folders, they store all the svn repo details, dont change them 😛
  • after you modify some code, type
    # svn commit
  • it will give you a list of all the changes you have made, and commit them back to the svn repo
  • you can then use trac to browse through the source code and the revision history

Leave a Reply

Your email address will not be published. Required fields are marked *