Subscribe to Jack of All Trades Web Development

Installing Subversion on Apache

MediaTemple, Linux

Media Temple Dedicated-Virtual dv hosting

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:

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
Please note that –– is two dashes, for some reason it copy and pastes as periods.
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:

rpm -q yum

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

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".

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:

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.

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:

chown -R apache.apache /svnroot

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

vi /etc/httpd/conf/httpd.conf

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

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:

<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].

/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 Jan 10 2008

    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 Jan 10 2008

    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

Post a Comment!