Getting SVN to work through Apache on

MediaTemple (dv) 3.5

After a few too many days of tweaking around with a MediaTemple (dv) 3.5 server, I finally got SVN (Subversion) to play nice with Apache.

It requires some tomfoolery, but I've condensed it down do a fairly simple commands.

First off, you'll require the MediaTemple developer tools and root access. So, unless you've already done so, log onto the MediaTemple account center and set yourself up.

Also, please note, that this tutorial assumes you already have an SVN repository created, if you don't there's many a tutorials elsewhere. I've used vim in this tutorial, so hopefully you're down with the lingo.

Once ready and logged onto the server, we dive into the shell goodness:

# install yum on ze server
rpm -Uvh http://mirror.centos.org/centos/5.1/os/i386/CentOS/yum-3.0.5-1.el5.centos.5.noarch.rpm
 
# update the packages on your server
# this can take a while, and isn't 100% required
yum -y update
 
# install subversion and mod_dav_svn, the main item missing from (dv) 3.5 servers
# You should be prompted to approve the installation of the package, so say yes when required
yum install subversion mod_dav_svn

Now that Yum and all the required modules are installed we can move on to setup Apache:

# create and edit a svn.conf file which will be automatically loaded by MT's web admin scripts
vim /etc/httpd/conf.d/svn.conf

We want to load the svn modules, using the following code:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Cool, that should be Apache all ready, now it's time to setup the repository. The following commands should get you on your way:

# change the directory to that of your repository
cd <path_to_repo>
 
# you only need to do this if you want to secure your repository
# this step isn't required, but if skipped will result in an open repo
 
# htpasswd will create a user account for "<user_name>"
# you'll be asked for a password
htpasswd -c .repoUsers <user_name>
 
# you can add as many others as you'd like using the following command
# htpasswd .repoUsers <user_name_b>
 
# now lets move through to the web root config
cd /var/www/vhosts/<domain>/conf
 
# lets edit the vhost.conf
vim vhost.conf

Okiday, now lets add a location to the vhost.conf. By default, you won't have one; but if you do, be sure to leave what's there as it is.

This is what you're going to add to the vhost.conf. Make sure you change the paths to match your own! Also, if you opted not to create secure the repository leave out the last 4 lines of the location code:

<location /svn>
	DAV svn
	SVNPath /var/www/vhosts/<domain>/repo
	AuthType Basic
	AuthName "Your Repository"
	AuthUserFile <path_to_repo>/.repoUsers
	Require valid-user
</location>

BAM! Just like that your repo and Apache setup should be done and dusted! Now it's just a matter of restarting Apache.

web

You should be able to enter the url into a browser and be hit with the authentication dialogue, mine is here: http://isnot.tv/svn.

If you get the dialogue then you're all done! If not, then something went FooBar, post a comment and I'll try to help you out.

Enjoy!

Comments

  1. Roded stumbled across an issue with CentOS 5.2 whereby you need to install an additional package before installing YUM: This is needed first: http://mirror.centos.org/centos/5.2/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm Then install Yum http://mirror.centos.org/centos/5.2/os/i386/CentOS/yum-3.2.8-9.el5.centos.1.noarch.rpm

    Aaron Wallis on
  2. We wrote a similar article for the DV 3.5 servers, enjoy : http://www.debuggeddesigns.com/blog/view/how-to-setup-a-subversion-svn-repo-on-a-media-temple-dv-3.5-server

    DeleteEditDebugged Interactive Designs on