Jul 10, 2009

Subversion Configuration on CentOS


Requirements
  • Apache 2
  • Subversion
  • PHP 5 + Pear + VersionControl_SVN
  • MySql


Subversion Installation

1. Download and install the basic packages required by Subversion by using yum command in Terminal
    #yum install subversion mod_dav_svn php-mysql php-pear httpd
2. Create a repository directory at /var/svn
    #mkdir -p /var/svn/repos
    #chown –R apache:apache /var/svn/
3. Create a configuration repository directory at /var/svn/repos
    #svnadmin create /var/svn/repos/myrepos
    #chown –R apache.apache /var/svn/repos/myrepos


SVN Manager Installation

1. Download the latest version of SVN Manager from here
2. Extract the tar files to /var/www/html/svnmanager
    #tar –xvzf svnmanager-1.05.tgz
    #mv svnmanager-1.035 /var/www/html/svnmanager


Version Control Installation

1. Download and install VersionContol_SVN by using pear command in Terminal
    #pear install --alldeps VersionControl_SVN-0.3.0alpha1.tgz


MySql Configuration

1. Create database for SVN Manager
    #mysql –u root
    Mysql>create database svn;
    Mysql>grant all privileges on svn.* to 'svnmanager'@'localhost' identified by '[password]';
    Mysql>flush privileges;
    Mysql>quit;


SVN Manager Configuration

1. Add the following commands in /etc/httpd/conf/httpd.conf
    <Location /repos>
    DAV svn
    SVNParentPath /var/svn/repos
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /var/svn/passwdfile
    AuthzSVNAccessFile /var/svn/accessfile
    Require valid-user
    </Location>

    <Directory "/var/www/html/svnmanager/">
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from all
    </Directory>
2. Create passwdfile and accessfile in /var/svn/ directory
    #touch /var/svn/passwdfile
    #touch /var/svn/accessfile
    #cd /var/svn
    #chown –R apache.apache passwdfile
    #chown –R apache.apache accessfile
3. Edit the commands as below in /var/www/html/svnmanager/config.php
    $htpassword_cmd = "/usr/bin/htpasswd";
    $svn_cmd = "/usr/bin/svn";
    $svnadmin_cmd = "/usr/bin/svnadmin";
    $svn_repos_loc = "/var/svn/repos";
    $svn_passwd_file = "/var/svn/passwdfile";
    $svn_access_file = "/var/svn/accessfile";

    $dsn = "mysql://svnmanager:[password]@localhost/svn";
4. Restart the Apache and Mysql with the following commands
    #service httpd restart
    #service mysqld restart
5. Open web browser and type in URL http://localhost/svnmanager



Using Subversion in Terminal

1. Make some test files
    #mkdir test1
    #cd test1
    #vim file1.cfg ~~ press Esc and Shift + z twice times to save
    #vim file2.cfg
2. Import project
    #svn import test1/ file:///var/svn/repos/myrepos -m "test file"
    Adding test1/file2.cfg
    Adding test1/file1.cfg
    Committed revision 1.
3. Check out
    #mkdir test2
    #svn co http://localhost/repos/myrepos
    A myRepos/file2.cfg
    A myRepos/file1.cfg
    Checked out revision 1.


** Subversion Configuration on Windows

3 comments:

  1. i followed these directions to the letter, and I had the same result that I had when following the directions on the SVNManager site. Go to load the page for the first time, and it is blank

    ReplyDelete
  2. do check error in apache. usually either php-pear not loaded properly

    ReplyDelete
  3. yum install php-mbstring
    then
    service httpd restart

    works!

    ReplyDelete