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/mysite.com/
# 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/mysite.com/conf/vhost.conf<Location /svn>
DAV svn
SVNParentPath /var/www/vhosts/mysite.com/svn/
AuthType Basic
AuthName "SVN"
AuthUserFile /var/www/vhosts/mysite.com/svn.password
Require valid-user
</Location> - Create the htpassword:
# htpasswd -c /var/www/vhosts/mysite.com/svn.password username
- Update plesk to install your vhost.conf file
# /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=mysite.com
- Now
you should be right with svn, visit mysite.com/svn, enter your
username/password and you should see a list of your repositories.
install trac
- download trac to server wget http://ftp.edgewall.com/pub/trac/Trac-0.11.tar.gz
tar zxvf Trac-0.11.tar.gz
cd Trac-0.11
less INSTALL << read itapt-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 ./setup.py install
trac-admin /var/www/vhost/mysite.com/trac/myproject initenvchown www-data: /var/www/vhost/mysite.com/trac -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/mysite.com/trac/myproject
PythonOption TracUriRoot /trac/myproject
</Location>
<Location /trac/myproject/login>
AuthType Basic
AuthName "trac"
AuthUserFile /var/www/vhosts/mysite.com/svn.password
Require valid-user
</Location> apt-get install python-subversion
/etc/init.d/apache2 force-reload- now hit mysite.com/trac/myproject and you should see it! woot!
configure trac
- as root:
# trac-admin /var/www/vhosts/mysite.com/trac/myproject 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
`trac-admin`
svn stuff
- you need to import you code into svn initially, like this:
# cd /path/to/my/code/
# svn import -m “initial import” http://mysite.com/svn/my_repo/project_name
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 http://mysite.com/svn/my_repo/project_name - 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