Put your message here! Contact me for more information
 
 








 


After much procrastination and personal interruptions (you can tell, I haven’t been blogging that often lately) , I’ve managed to install Subversion running as a subdomain with Plesk 8.0 and CentOS 4.3. I’m very excited because now I officially have a place to house my various projects. Before, I’ve been using my buddy, Long Giao,’s box in … Vietnam as the SVN server. One thing for sure, I did try my best to avoid installing Subversion by myself because I know that I’d be frustrated due to my lack of linux skills. Anyway, I did it, all by myself. So here’s how it goes.

(I think this guide is probably the only how-to guide to setup SVN as a subdomain with Plesk 8.0. There’s one other article you can find with Google but it’s in German. Oh well.)

==== My pre-SVN configuration ====

* Plesk 8.0
* CentOS
* Root access via SSH
* Subdomain setup via Plesk 8.0 Administrator page. In my case, I used svn.my-domain.com as the sub domain
* A folder /var/svnrepo/ is used to house my SVN repository.

After you created the subdomain for your domain, you can proceed to the next step: installing Subversion

==== A. Installing Subversion ====

To install subversion, all you have to do is SSH into the box as the root user. (# denotes the root prompt)

* #yum install subversionThis command will painlessly install the subversion package to the CentOS.
* #cd /etc/httpd/modulesChange the current directory to the modules folder of Apache, where all the plugins of Apache are installed.
* #yum mod_dav_svnThis command will install the mod_dav_svn to apache
* #svn --versionThis command will ensure that you have successfully installed subversion. (At the current time of writing, the version of this SVN package is 1.1.4, while the current version of SVN is 1.4 — maybe another article on how to upgrade SVN?)
* #mkdir /var/svnrepoThis is our root repository.
* #svnaddmin create /var/svnrepoThis command will create a subversion repository in the /var/svnrepo folder.
* #chmod -R 777 /var/svnrepoChanging the permision of svnrepo folder to allow Apache/Subversion to have read/write rights. Without changing the permissions, you will get an error when you are trying to access the repository via your browser.

==== B. Configuring Apache ====

So with the painless installation of Subversion, now we can configure Apache to begin to serve our repository. First of all, you will need to make sure that Apache is loading the mod_dav_svn.so file. Personally, I like to use mc (Midnight Commander) for text-editting ((( *) I can use VI but it’s not on my list of user-friendly software so I opt for a more “notepad-like” text editor. If you don’t have Midnight Commander installed, run **#yum install mc** and that should take care of it. The nto run Midnight Commander, just type in #mc. If you use Putty like I do, use **#mc -a** instead to get a nicer frame instead of the weird ASCII characters.)).

* Open the file **/etc/httpd/conf/httpd.conf**
* Search for **mod_dav_svn.so** in the Modules section. If you don’t find this line in **httpd.conf**, then check the folder /etc/httpd/conf.d/ for other .conf files. I have a subversion.conf file here which is included in the main **/etc/httpd/conf/httpd.conf** at initialization time. In this subversion.conf file, there are these 2 lines to make sure that Apache loads the SVN modules:
#File: /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
Cool! Apache does load the Subversion modules. Now we need to configure our subdomain created using Plesk earlier to use with Subversion. But let’s go over how Plesk organizes our file system.

==== C. Working with Plesk: The primer ====
If you’d like to by-pass the web-based administration page of Plesk and do some advanced customization, then here is how Plesk is organizing the files system:

* Web-docs (your domains) are stored under **/var/www/vhosts/**
* Custom configuration for your domain is stored under **/var/www/vhosts/[you_domain_name]/conf/vhost.conf**
* The **httpd.include** file in **/var/www/vhosts/[you_domain_name]/conf/** will be overwritten everytime you use the web-based Plesk to update your domain configuration. Hence manual updates of this file is NOT advisible. Your changes will be lost, so why bother. If you want to customize the domain, create a **vhost.conf** file in the conf/ folder instead.
* Similarly, for sub-domains, the main .conf file are **/var/www/vhosts/[you_domain_name]/subdomains/[you_subdomain_name]/conf/vhost.conf**. All you have to do is to create this vhost.file and it will be automatically included in the main httpd.conf file of apache.

Also,

* Only **Root users** can create vhost.conf files.
* After you make changes to the conf files, you have to tell Plesk to reload the new configuration. To do so, run#/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=

For more information, please consult the [[http://download1.swsoft.com/Plesk/Plesk7.5/Doc/plesk-7.5r-admins-guide-html/apas02.html|Plesk’s Admins Guide on sub-domain customization]]

==== D. Customizing Sub-Domain configurations ====

As I created a subdomain “svn” for my site, makefun.us, I had to create a vhost.conf file under **/var/www/vhosts/makefun.us/subdomains/svn/conf/vhost.conf**. Also, my repository is under **/var/svnrepo/**, so here is the content of the vhost.conf file


#svn.makefun.us -- vhost.conf file

DAV svn
SVNPath /var/svnrepo/
AuthType Basic
AuthName “Makefun.us Subversion Repository”
AuthUserFile /etc/svn-auth-file
Require valid-user


First of all, with **DAV svn** we ask Apache to hand over to the mod_dav_svn module when there’s a request to **http://svn.makefun.us** (the location /). Then we specify the **repository’s root** at **/var/svnrepo/**. Then we specify that this is a private repository by asking Apache to provide **Basic Authorization** (which means the authenticated password will be transmitted as text via the wire). Well, we name our private zone the “Makefun.us Subversion Repositor” and the user accounts are stored in **/etc/svn-auth-file**. Finally, to access the repository via the web, the user must be able to authenticate — as we only allow valid-user to access (Require valid-user)

Next, I created a new user account for myself so that I can access the repository:

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

At this point, you can either restart Apache by running **#server httpd restart** or just use the **websrvmng** of Plesk to pick up the new configuration. I just restarted Apache.
If everything works out correctly for you, if you point your browser to **http://svn.yourdomain.com**, you would see a prompt for username and password. Enter your just created account, you can access to your very own the SVN repository. How amazing is that?

==== Final Remarks ====

I hope that you enjoy this how-to and you are able to configure SVN with Plesk. Now after I’ve done it, I’d say the entire process should take you less than 15 minutes. As this is my first draft and it’s fairly late (3:38AM), there will be typos and errors. So your input is very welcome. Thanks!


 

24 Responses to “Installing Subversion with Plesk 8.0/ CentOs 4.3 as Subdomain



Bob Jones
9:55 am
October 21, 2006
#1351

Dood, how did you get plesk on a 4.3 box? or did you upgrade from 4.2? Can you point me somewhere that shows me how to do custom plesk installs?

Thanks in advance!




10:09 am
October 21, 2006
#1352

@Bob

Actually I had my host installed it for me. I haven’t messed around with Plesk and CentOS too too much, so I can’t help you here. My best guess is just google and dig through the SWSoft help page.

Alex




5:54 pm
October 24, 2006
#1499

i followed your directions for svn.imagexmedia.com however it didn’t have the end result that yours did. It doesn’t seem to have changed anything.

I followed the instructions exactly. Any ideas? Thanks

Chris




8:51 pm
October 25, 2006
#1559

@Chris,

I’ve checked your SVN subdomain and it seems to me that the web server is requesting for authentication, which is a good sign. I’m not quite sure what you mean by “it doesn’t seem to have changed anything.” (I found out the hard way that a lot of things can go wrong in the linux world, not to say that windows is any better, but … I’m just not too good at Linux)

If I were you, I would do the following:

1. Check to see if SVN is up and running ( svn –version)
2. Do a checkout to a local directory on your server to see if the repo is setup correctly.
3. Check on the permission of the repo to see if the apache/mod_dav or whatever can access to it.
4. Check again the configuration for the sub-domain virtual host to see if mod_dav is loaded properly.
5. I’d …reboot the system, just in case, or at least restart the web-server.

Good luck!

Alex




1:39 am
October 27, 2006
#1626

Hey Alex,

Thanks for you help. I figured out the problem I had to run a command to tell apache to update its configuration (as you did mention in your tutorial - but i must of skimmed over). Everything worked great after that.

On a different note, I have found that most people using subversion are using it for software development. However, in my case I am attempting to use it for web site development which is a little different because I want the file to be immediately accessibile by ftp and viewable in the browser not as the SVN view but in a normal website view.

Does that make sense? Any suggestions?

Thanks again for the great tutorial. It was very easy to follow and clear!

Take care,

Chris




11:11 am
October 27, 2006
#1641

@Chris,

Congrats on getting the SVN stuff working. It’s neat to be able to keep track of your work, no matter where you are and no matter what you do, right?

SVN is built to keep track at anything non-binary, which are source code, text files, HTML, PHP, ASP, CFML, etc.. So SVN is perfect for web development. I totally understand your question, and the solution is to have the webdocs folder to be a checkout working copy from the main repo. This way, you can just do a “svn update” on the document root folder and have all the files updated.

I’d recommend you to read through my quick tutorial on setting up SVN with POST-COMMIT hook. I believe that this article will provide an answer to your question. Here’s the link: http://alexle.net/archives/139. I know this is shameless self-advertising, but I do like to share my experience with SVN to other web developers out there as there are not very many resource on how to apply SVN to a specific real world situation.

Cheers,

Alex




RRN
1:32 am
November 14, 2006
#2446

Very useful how-to! This weekend I followed your instructions and would like to comment the following:

1- When you want to host svn for multiple domains, name use /var/svnrepos and store a repository for each domain there: ’svnadmin create /var/svnrepos/nederhoed.com’

2- use ‘chmod -R apache:apche /var/svnrepos’ to give explicitly only apache access to this area, instead of every user

3- When adding an existing httpdocs to your repository, checkout an empty project (say ‘website’) in that httpdocs, than ’svn add’ and ’svn commit’ files and folders from your httpdocs. This instead of ’svn import’, which does effect the repository, but doesn’t add the stuff you import to the working copy, making it virtually impossible to check them out later in that same httpdocs spot: ‘file already exists’

Friendly greetings from The Hague, NL.




11:20 am
December 22, 2006
#10471

if ” #yum mod_dav_svn ” doesn’t work then replace it with ” #yum -y install mod_dav_svn “




David
12:06 pm
February 15, 2007
#16460

Good work! Thanks for putting in the time to document this - really useful - especially the part about where plesk stores config.

Cheers
David




Thomas
2:15 pm
March 27, 2007
#20134

Thank You for that very useful how-to. After one week hard work and not able to run svn on my server I found Your fabulous instruction-kit.

Most worked after copy&paste, but one failure had been made by myself that I didn’t remove the ‘#’ in col1 of the reconfigure command.. that’s life :)

One more time Thank You, it works..




2:52 pm
March 27, 2007
#20136

@Thomas

Thank you for making my day :) I’m glad that my little guide is able to help other people getting SVN working.

So happy coding!




webdevotion
5:23 pm
May 9, 2007
#28776

tnx, very usefull post

To upgrade to subversion 1.4.3 on a i386 you can use this solution.
Make sure to “unprotect” the base and main sections in the mentioned files and to restart apache after upgrading.

http://languor.us/node/34




Ryan W
2:43 pm
May 27, 2007
#32142

I came across an issue while using this method. I was able to create the repository, check it out and update it. I cannot add anything via commit however. Seems to be something wrong with the path. Everything works great when using the main domain/svn as opposed to using the subdomain. I have many projects in the one repository. But I get the following error:

Error: Commit failed (details follow):
Error: PROPFIND request failed on ‘/holdstill/trunk/docs/test2.txt’
Error: Could not open the requested SVN filesystem

Any ideas on this?




1:29 am
June 7, 2007
#37466

Thank you so much for writing this!




Nick M
5:56 am
August 14, 2007
#49642

Great tutorial, thanks!

Vincent mentioned the “yum mod_dav_svn” command is wrong. Pretty easy to figure out, but that may be a point of frustration for us less skilled users.

Also “svnaddmin create /var/svnrepo” should be “svnadmin create /var/svnrepo”. That one took me a few minutes. I’m new at this.

Thanks again!




2:38 am
August 28, 2007
#51972

I’m getting an issue with configuration in the vhost.conf file. When I restart the web server I get two warnings
websrvmng: Service /etc/init.d/httpd failed to gracefully restart
websrvmng: Service /etc/init.d/httpd failed to gracefully restart

This issue doesn’t happen when I delete the file and restart the web server. My vhost.conf file contains the following:

DAV svn
SVNPath /var/www/vhosts/explodingbox.com/subdomains/svn/explodingbox
AuthType Basic
AuthName “Exploding Box Productions Subversion Repository”
AuthUserFile /var/www/vhosts/explodingbox.com/subdomains/svn/svn-auth-file
Require valid-user

I’ve double checked the locations of the repo and svn-auth-file and they are exact. I’ve tried a full restart of the system and no luck on that either.




2:40 am
August 28, 2007
#51974

The vhost.conf also includes the location tags as well, they were removed out of my comment.




2:18 pm
September 19, 2007
#58462

Was just asking how to do this - thank you!




Matt
12:30 pm
October 24, 2007
#70078

Hey, I cannot get this svn to work. when I go to svn.jnmedia.com, it doesn’t ask for username/pwd. I’ve done everything in your tutorial and it’s still not working. I don’t know what else to do. Please help.




7:28 am
November 27, 2007
#82284

Matt, I got stuck at the step where you reconfigure the vhost. I was typing

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

and it didn’t work. After typing
/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=yourdomain.com

it worked fine. So enter the whole domain at the end there, not just the sub domain.




9:01 am
November 27, 2007
#82298

/var/svnrepo should not be world-writeable (777) unless you want any user to be able to delete it.

instead (assuming you’ve already executed the commands indicated in this tutorial):

chown -R apache.apache /var/svnrepo
chmod o-rwx /var/svnrepo




9:36 pm
December 27, 2007
#93880

Thanks for posting this process,

You should update the command: #yum mod_dav_svn
it should be: #yum install mod_dav_svn

cheers,




Andrew
9:00 am
January 20, 2008
#104152

Thanks SO much for this!!

I was using the mutple repo setup on plesk (knownhost), and found I have to use (in vhost.conf)

SVNParentPath /var/svnrepos

Instead of Svnpath

to avoid “Could not open the requested SVN filesystem”




6:47 am
May 3, 2008
#150505

Thanks very much indeed for that clear and well documented work.

b




 

Leave a Reply