Installing Subversion on Apache: Media Temple, Linux

Installing Subversion on Apache

Tags: Media Temple, Linux | Written on 21/11/07

Media Temple Dedicated-Virtual dv hosting

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:
  1. rpm -ivh --nodeps http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/libxml2-python-2.6.16-10.i386.rpm
  2. 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
  3. 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
  4. rpm -ivh --nodeps http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm
  5. wget http://centos.mirror.vpslink.com/centos-4/4.5/os/i386/CentOS/RPMS/yum-2.4.3-3.el4.centos.noarch.rpm
  6. rpm -Uvh yum-2.4.3-3.el4.centos.noarch.rpm

To check if it is installed run this command:

Bash:
  1. rpm -q yum

Now we need to install subversion and to run it through apache we need mod_dav_svn (apache 2 modules).

Bash:
  1. yum install subversion
  2. 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:
  1. svnadmin create /svnroot
  2. 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:
  1. 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:
  1. 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:
  1. chown -R apache.apache /svnroot

Next, lets jump in the apache config and load the proper modules and set the svn location.

Bash:
  1. vi /etc/httpd/conf/httpd.conf

Press 'i' to insert into the document and in the LoadModule section add these two lines:

Bash:
  1. LoadModule dav_svn_module modules/mod_dav_svn.so
  2. 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:
  1. <Location /repos>
  2.   DAV svn
  3.   SVNPath /svnroot
  4. </Location>

Hit esc and than :x to quit and save the file. Restart your apache server, you should get an ok message [ok].

Bash:
  1. /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

#1. dotjay on 10/1/08
Just a minor point that the Location directive should be ... for the example Web address to work: http:///svn Otherwise it's http:///repos J
#2. dotjay on 10/1/08
Bits of my comment were junked: Just a minor point that the Location directive should be "Location /svn" for the example Web address to work: http://ip/svn Otherwise it's: http://ip/repos J
#3. Aaron on 8/7/08
Hey there,
I've just posted a new tutorial on setting up SVN on a (dv) 3.5 server:
on my blog
#4. Marc Grabanski on 8/7/08
Aaron: Thanks for letting us know. 3.5 was a pretty big upgrade for (dv)s. We ended up installing SVN through Apache in the same way, so thanks again - this saves me from writing another article. ;)
#5. alongkorn on 29/7/08
I got error msg. after following all steps

svn: PROPFIND request failed on '/svn/testProj'
svn: PROPFIND of '/svn/testProj': 405 Method Not Allowed (http://192.168.189.129)

what 's happen ?
#6. Marc Grabanski on 29/7/08
405 is a general error, so a number of things may be happening. Triple check the paths you used.

Leave a Comment