How to setup Subversion with apache and working copy
Subversion is a very powerful tool that is widely used in development field. Using subversion, we can create a repository where a team can work very easily. Also It can be used to recover old datas and compare different version. Using subversion with eclipse make it as a useful tool for developer.
Please wait while we retrieve data from server .............
Steps to install and setup subversion are given below. p, li { white-space: pre-wrap; }
1, Compiling subversion
First we need to install subversion.
{codecitation} yum install subversion{/codecitation}
2, Creating a repository
Now create a repository.
{codecitation} svnadmin create /home/svnrepos{/codecitation}
You can give a login in the file given below.
{codecitation} /home/svnrepos/conf/passwd
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret{/codecitation}
You can start the application as follows.
{codecitation} svnserve -d {/codecitation}
3. Import SVN directory
Now import the data to svn repository as follows.
{codecitation}
svn import /home/domainuser/public_html file:///home/svnrepos/domainuser --message "first"
svn://<ip>/home/svnrepos/domainuser {/codecitation}
44. Setting up httpd.conf to serve the created repository
{codecitation}
<VirtualHost <ip>:80>
ServerName svn.domain.com
RedirectPermanent / https://svn.domain.com/
</VirtualHost>
<VirtualHost <ip>:443>
ServerName svn.domain.com
DocumentRoot /var/www
<Directory /home/svnrepos>
Order deny,allow
Deny from all
Allow from all
</Directory>
<Location /domain1>
DAV svn
SVNPath /home/svnrepos/domain1
AuthType Digest
AuthName DOMAIN1
AuthUserFile /etc/httpd/conf/htpasswdsvndig
Require valid-user
</Location>
SSLEngine on
SSLCertificateFile /etc/ssl/server.crt
SSLCertificateKeyFile /etc/ssl/server.key
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
LogLevel debug
# LogLevel warn
</VirtualHost>
{/codecitation}
Now you can access svn from browser as follows.
{codecitation} http://svn.domain.com{/codecitation}
Now if you want to update the live server once it is commited, you can write a simple post-commit script as follows.
{codecitation}
/home/svnrepos/hooks/post-commit
#!/bin/bash
/usr/bin/svn update /home/domainuser/public_html > /home/svnrepos/hooks/post-commit-log
/bin/chown -R domainuser: /home/domainuser/public_html{/codecitation}