Subversion is a open source version control system that will manages files and will keep the changes made to the files. In this post i will share the quick steps to install and configure subversion on linux CentOS 6.2 server.
1. Install subversion using yum install :
[root@svn ~]# yum install mod_dav_svn subversion -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.hostemo.com * extras: mirrors.hostemo.com * rpmforge: mirror.oscc.org.my * updates: mirrors.hostemo.com Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mod_dav_svn.i686 0:1.6.11-2.el6_1.4 will be installed ---> Package subversion.i686 0:1.6.11-2.el6_1.4 will be installed --> Processing Dependency: perl(URI) >= 1.17 for package: subversion-1.6.11-2.el6_1.4.i686 --> Processing Dependency: libneon.so.27 for package: subversion-1.6.11-2.el6_1.4.i686 --> Running transaction check ---> Package neon.i686 0:0.29.3-1.2.el6 will be installed --> Processing Dependency: libpakchois.so.0 for package: neon-0.29.3-1.2.el6.i686 ---> Package perl-URI.noarch 0:1.40-2.el6 will be installed --> Running transaction check ---> Package pakchois.i686 0:0.4-3.2.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: mod_dav_svn i686 1.6.11-2.el6_1.4 CentOS6.2-Repository 79 k subversion i686 1.6.11-2.el6_1.4 CentOS6.2-Repository 2.2 M Installing for dependencies: neon i686 0.29.3-1.2.el6 CentOS6.2-Repository 120 k pakchois i686 0.4-3.2.el6 CentOS6.2-Repository 21 k perl-URI noarch 1.40-2.el6 CentOS6.2-Repository 117 k Transaction Summary ==================================================================================================== Install 5 Package(s) Total download size: 2.6 M Installed size: 12 M Downloading Packages: ---------------------------------------------------------------------------------------------------- Total 7.3 MB/s | 2.6 MB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-URI-1.40-2.el6.noarch 1/5 Installing : pakchois-0.4-3.2.el6.i686 2/5 Installing : neon-0.29.3-1.2.el6.i686 3/5 Installing : subversion-1.6.11-2.el6_1.4.i686 4/5 Installing : mod_dav_svn-1.6.11-2.el6_1.4.i686 5/5 Installed: mod_dav_svn.i686 0:1.6.11-2.el6_1.4 subversion.i686 0:1.6.11-2.el6_1.4 Dependency Installed: neon.i686 0:0.29.3-1.2.el6 pakchois.i686 0:0.4-3.2.el6 perl-URI.noarch 0:1.40-2.el6 Complete!
2. Setting up directories
[root@svn ~]# mkdir /svn [root@svn ~]# mkdir /svn/repos [root@svn ~]# mkdir /svn/users [root@svn ~]# mkdir /svn/permissions [root@svn ~]# chown -R apache:apache /svn
3. Configure httpd Apache server as below:
<VirtualHost *:80> ServerAdmin webmaster@svn.ehowstuff.local DocumentRoot /svn/repos ServerName svn.ehowstuff.local ErrorLog logs/svn.ehowstuff.local-error_log CustomLog logs/svn.ehowstuff.local-access_log common </VirtualHost>
4. Create and Configure subversion.conf
[root@svn ~]# vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn/repos> DAV svn SVNParentPath /svn/repos AuthType Basic AuthName "Authorization Realm" AuthUserFile /svn/users/passwords AuthzSVNAccessFile /svn/permissions/svnaccess Require valid-user </Location>
5. Create first repository using svnadmin command
[root@svn ~]# svnadmin create /svn/repos/testrepo [root@svn ~]# chown -R apache:apache /svn/repos/testrepo
6. Create htpasswd user to access the testsvn repository
[root@svn ~]# htpasswd -c /svn/users/passwords svnuser1 New password: Re-type new password: Adding password for user svnuser1
7. Create svnaccess file to access the testrepo repository
[groups] testgroup = svnuser1 [testrepo:/] @testgroup = rw
8. Test your subversion server from browser :
http://svn.ehowstuff.local/svn/repos/testrepo/