5
Jul

Installing Subversion on CentOS with Plesk

Just a quick walk through on installing subversion on a CentOS server running Plesk. What your going to want to grab is a fresh copy of YUM to handle the installation of subversion. YUM ( Yellow dog Updater, Modified) is “… an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm…”

First thing your going to want to do is grab a copy of YUM if you don’t already had it installed, you can check to see if you have YUM installed by typing #yum in your terminal, if you see something like “Loading “installonlyn” plugin” then you have yum installed and then just skip this step, if you see something like “-bash: yum: command not found” then your going to need to install yum. Start by creating an install directory

Step 1.

#mkdir /usr/local/src/yum
#cd /usr/local/src/yum

next download the yum rpm

#wget http://mirror.centos.org/centos/4/apt/i386/RPMS.os/yum-2.4.3-3.el4.centos.noarch.rpm

now install yum

#rpm -Uvh *rpm

finally update your yum

#yum -y update

If you want to clean up after yourself, you can delete the install directory you created at the begining of this step by

#rm -rf /usr/local/src/yum

now your ready to install Subversion

Step 2.

Install Subversion

#yum -y install subversion

Done! you can test subversion is successfully installed by typing #svnadmin in your console, you should see something like “Type ‘svnadmin help’ for usage.”

Step 3. Now your going to want to configure subversion to work with plesk. I like to keep things separate, so I run my subversion server through a subdomain http://svn.domain.com so this part will walk you through configuring subversion in a subdomain.

Your going to want to make sure thatmod_dav_svn.so is being loaded into your http.conf, to do this type

#vi /etc/httpd/conf/httpd.conf

search for “mod_dav_svn.so” in your LoadModules section

my httpd.conf file has the following lines which you can copy and paste into yours

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

once you have done this, save the httpd.conf file [esc + w + q (escape, write, quit)]

Step 4
Next your going to want to create your central repository, lets put it in the /var/www directory

mkdir /var/www/repository
svnadmin create /var/www/repository

note, if you choose not to place your repository in this directory, you may run into an issue I came across where my repositories were not configured for the web, and although the authentication windows would display and svn was running correctly, the web browser wouldn’t show the repos correctly.

After a lot of testing and not getting it to work i read this post: http://www.svnforum.org/2017/viewtopic.php?t=372&postdays=0&postorder=asc&start=15 and it basically said that if your running centos or rehl then there is a known issue on some configurations that causes svn over http not to work due to permissions. this is fixed by putting your repository in the /var/www directory. so my repo is now in /var/www/repository and that worked, this is why I suggested putting the repository in this directory’

now you have a working subversion repository you can start using, but it isn’t accessible to web users yet.

Step 5
Now since plesk will rewrite the main site configuration files every time you use plesk your going to want to write a configuration file in your vhost conf folder

#vi /var/www/vhosts/[you_domain_name]/subdomains/[you_subdomain_name]/conf/vhost.conf

This vhost file will automatically be included in apache’s httpd.conf file. The vhost.conf file will contain the instructions for you subdomain to map to your svn repository.

Edit your vhost.conf file to contain the location of your svn files as shown below

 #svn.yourdomain.com -- vhost.conf file
Location /
DAV svn
 
SVNPath /var/www/repository
AuthType Basic
 
AuthName "Subversion Repository"
 
AuthUserFile /etc/svn-auth-file
Require valid-user
/Location

Save your changes. Now you’ll want to add a valid user to this repository by typing

#htpasswd -c /etc/svn-auth-file my_user_name

whenever you make a change to your vhost files your going to want to restart apache using

/etc/init.d/httpd restart

and there you go… now you should be able to browse to your subdomain and use your repository on your CentOS box running Plesk.

Cheers.

There's 6 Comments So Far

  • Creating A Sub Domain
    August 31st, 2008 at 6:36 pm

    anybody here know of a good site to find more info on creating a sub domain? I’ve got this site bookmarked and im gonna keep checking it out, but i still would like to find a site that covers creating a sub domain a little more thoroughly..thanks

  • What Is A Sub Domain
    September 4th, 2008 at 10:36 am

    anybody here know of a good site to find more info on what is a sub domain? I’ve got this site bookmarked and im gonna keep checking it out, but i still would like to find a site that covers what is a sub domain a little more thoroughly..thanks

  • gudata
    April 25th, 2009 at 2:18 pm


    #svn.yourdomain.com -- vhost.conf file
    Location /
    DAV svn

    SVNPath /var/www/repository
    AuthType Basic

    AuthName "Subversion Repository"

    AuthUserFile /etc/svn-auth-file
    Require valid-user
    /Location

    I think that Location and /Location should be

    ......

    Also here is how you can reload the domain configuration from plesk


    /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=svn.yourdomainname.com

  • Tim
    August 29th, 2009 at 6:25 am

    Shouldn’t ist be and instad of Location / and /Location. Because it only works when i put the around it.

  • Tim
    August 29th, 2009 at 6:26 am

    Shouldn’t ist be <Location /> and </Location> instad of Location / and /Location. Because it only works when i put the <..> around it.

  • Hunter
    October 26th, 2009 at 4:09 am

    What gudata was trying to say is that “Location /” and “/Location” need proper less-than and greater-than symbols around them to work.

Share your thoughts, leave a comment!