Subversion On Centos

Installing Subversion With HTTP Support On CentOS:

  1. To find out subversion.conf file already exist in below location.

ls /etc/httpd/conf.d

php.conf proxy_ajp.conf README ssl.conf welcome.conf

  1. Install subversion and mod_dav_svn for apache

yum install mod_dav_svn subversion

Use the below command when you got dependency pacakages means that,

Yum install subversion.x86_64 mod_dav_svn

  1. Now find out the conf file for svn

ls /etc/httpd/conf.d/

php.conf  proxy_ajp.conf  README  ssl.conf  subversion.conf  welcome.conf

  1. Take original file as backup.

For example: zip –r project_folder_name.

zip –r blacksheep

  1. vi /etc/httpd/conf.d/subversion.conf

<Location /svn>

DAV svn

SVNListParentPath on

SVNParentPath /var/www/svn

AuthType Basic

AuthName “Subversion Repositories”

AuthUserFile “/etc/httpd/conf.d/svnuserconf”

Require valid-user


  1. Create User account.
    1. For first user creation.

i.      htpasswd –cm /etc/httpd/conf.d/svnuserconf admin

Adding password for user admin

  1. For second user creation.

i.      htpasswd –m /etc/httpd/conf.d/svnuserconf vijay

Adding password for user vijay

  1. mkdir /var/www/svn —- > Create svn folder
  2. Goto svn directory (cd /var/www/svn).
  3. svnadmin create blacksheep_repos => Create SVN repositories using their project names.
  4. chown apache.apache -R blacksheep_repos
  5. chcon -R -t httpd_sys_content_t blacksheep_repos
  6. /etc/init.d/httpd restart
  7. In browser see http://ip/svn/

Add a New Project into the repository using import command:


svn import prtfolder_name file://var/www/svn/svn_repos/projectfolder_name -m “First Import”.


Go to html directory => /var/www/html

svn import dentrecon file:///var/www/svn/ -m “First Import”.

Check out the project files:

svn checkout file:///var/www/svn/

Getting a List of Project on SVN repositories:

svn list –verbose file:///var/www/svn/

Remove .svn files under the /var/www/html/projectfolder:

find ./ -name “.svn” | xargs rm –Rf

Remove particular .svn files under particular directory:

find /path/to/files ! –name “*.svn” –type f –delete

Example: /var/www/html/app ! –name “*svn” –type f –delete

Review the files which are changes made using SVN:

svn status

To setup automatic update to the web project every time we make commit to the repository

Go to folder /var/www/svn/hooks

Create a file svnupdate.c

#include <stddef.h>

#include <stdlib.h>

#include <unistd.h>

int main(void)


execl(“/usr/bin/svn”, “svn”, “update”, “/var/www/html/”, (const char *) NULL);



And compile the file by using the command below:

gcc -o svnupdate svnupdate.c

chown root.root svnupdate

chmod +s svnupdate

Test your compiled code by running the command below

env ./svnupdate

If you see notification something like below, then your compiled code is success:

At revision 1.

still under folder var/www/svn/yourproject/hooks

copy-paste file post-commit.tmpl, then name it to post-commit (without any extension) and put the code below:





And change the file permisson

chmod 755 post-commit

Restart your server.


Share your thoughts with us!!!

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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