su - ## OR ## sudo -i
yum install mod_dav_svn subversion
Note: If you don’t have Apache installed already, this command installs it also. [http://www.if-not-true-then-false.com/2010/install-apache-php-on-fedora-centos-red-hat-rhel/ Read more about installing Apache and PHP »]
Add following config to
/etc/httpd/conf.d/subversion.conf
file:
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn> DAV svn SVNParentPath /var/www/svn AuthType Basic AuthName "Subversion repositories" AuthUserFile /etc/svn-auth-users Require valid-user </Location>
Use following command:
## Create testuser ## htpasswd -cm /etc/svn-auth-users testuser New password: Re-type new password:
Note: Use exactly same file and path name as used on subversion.conf
file. This example use /etc/svn-auth-users
file.
mkdir /var/www/svn cd /var/www/svn svnadmin create testrepo chown -R apache.apache testrepo chcon -R -t httpd_sys_content_t /var/www/svn/testrepo ## Following enables commits over http ## chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo
Restart Apache:
/etc/init.d/httpd restart ## OR ## service httpd restart
Goto http://localhost/svn/testrepo
address and you should see something like following, write username and password:
SVN testrepo revision 0:
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf
file:
## Disable anonymous access ## anon-access = none ## Enable access control ## authz-db = authz
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
Then import template to project repository using “svn import” command:
svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/ Adding /tmp/svn-structure-template/trunk Adding /tmp/svn-structure-template/branches Adding /tmp/svn-structure-template/tags Committed revision 1.
Check results on browser and see testrepo revision 1: