Installing Subversion on Apache

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:
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.rpmTo 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
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 /svnrootNext, lets jump in the apache config and load the proper modules and set the svn location.
vi /etc/httpd/conf/httpd.confPress ‘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://
9 comments
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
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
Hey there,
I’ve just posted a new tutorial on setting up SVN on a (dv) 3.5 server:
on my blog
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. ;)
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 ?
405 is a general error, so a number of things may be happening. Triple check the paths you used.
Dear author,
I can not install mod_dav_svn by command: yum install mod_dav_svn. The system show error:
Setting up Install Process
Parsing package install arguments
No package mod_dav_svn available.
Nothing to do
-————————I tried with RPM command (and similar) but it still show error.
How will I solve this problem?
My system: CentOs 5.x
Thank
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
change from:
LoadModule dav_svn_module modules/mod_authz_svn.so
to:
LoadModule authz_svn_module modules/mod_authz_svn.so