Installing Subversion on Apache
Tags: Media Temple, Linux | Written on 21/11/07
- Part 1: Media Temple Dedicated Server Setup
- Part 2: Installing Subversion on Apache
- Part 3: Subversion (SVN) Authentication and Auto Update

Note on June 24, 2008: Media Temple released their (dv) 3.5 which has a new set of developer tools, subversion and yum are installed - so you should be able to skip past the first few steps. You still may need to install mod_dav apache module with, "yum install mod_dav".
How to install subversion on a Media Temple dedicated virtual (dv) 3.0 linux server.
In the first part of setting up a dedicated server with Media Temple, I found out how to install PHP5 and learned some basic linux commands. I quickly realized how difficult linux can be if you don't know what you are doing. Luckily, YUM made my life a lot easier.
YUM is helps you easily install packages with simple commands on linux. First, lets install YUM and use it to install subversion. Run these commands one-by-one:
Bash:
rpm -ivh --nodeps http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/libxml2-python-2.6.16-10.i386.rpm rpm -ivh --nodeps http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm rpm -ivh --nodeps http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/rpm-python-4.3.3-22_nonptl.i386.rpm rpm -ivh --nodeps http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm wget http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/yum-2.4.3-3.el4.centos.noarch.rpm rpm -Uvh yum-2.4.3-3.el4.centos.noarch.rpm
To check if it is installed run this command:
Bash:
rpm -q yum
Now we need to install subversion and to run it through apache we need mod_dav_svn (apache 2 modules).
Bash:
yum install subversion yum install mod_dav_svn
I found a few articles on setting up subversion, but I'll walk you through how I got it to work. First I needed a home location, I chose to call this "svnroot".
Bash:
svnadmin create /svnroot svn mkdir file:///svnroot
Now, I want to import the httpdocs of my subdomain into the <project>/trunk. You can name your project whatever you would like. Don't forget to replace the domain, subdomain and project name in this next command:
Bash:
svn import /var/www/vhosts/<domain>/subdomains/<subdomain>/httpdocs file:///svnroot/<project>/trunk/dev -m 'Initial import of dev httpdocs'
To test that my files were imported correctly and the svn repository was created successfully, I ran this command.
Bash:
svn checkout file:///svnroot/<project>/trunk/dev #/svnwork
Vuala! - it downloaded my httpdocs to the #/svnwork directory. Now lets setup our SVN through apache. First, lets give Apache access to the folder:
Bash:
chown -R apache.apache /svnroot
Next, lets jump in the apache config and load the proper modules and set the svn location.
Bash:
vi /etc/httpd/conf/httpd.conf
Press 'i' to insert into the document and in the LoadModule section add these two lines:
Bash:
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule dav_svn_module modules/mod_authz_svn.so
And lets add the SVN location for apache to access. Careful, this does not add any authentication so you are giving free reign to your SVN server until then. Add this to your apache config:
Bash:
<Location /repos> DAV svn SVNPath /svnroot </Location>
Hit esc and than :x to quit and save the file. Restart your apache server, you should get an ok message [ok].
Bash:
/etc/init.d/httpd restart
Now download the windows subversion client and install. Let's test to see if our Apache subversion module worked. Use 'http://<server ip address>/svn to see verify it worked.
Comments
I've just posted a new tutorial on setting up SVN on a (dv) 3.5 server:
on my blog
svn: PROPFIND request failed on '/svn/testProj'
svn: PROPFIND of '/svn/testProj': 405 Method Not Allowed (http://192.168.189.129)
what 's happen ?