Installing Subversion with Plesk 8.0/ CentOs 4.3 as Subdomain

==== 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

Advertisements

One thought on “Installing Subversion with Plesk 8.0/ CentOs 4.3 as Subdomain

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s