Install Subversion [SVN] on Linux Server

how to install SVN (Subversion) server on Fedora , Red Hat (RHEL).






Install Packages:-
# yum install mod_dav_svn subversion

 

Modify Subversion config file /etc/httpd/conf.d/subversion.conf

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>

How to Add SVN  users:-

Use  command:
## Create user vishal ##
htpasswd -cm /etc/svn-auth-users vishal
New password:
Re-type new password:
Adding password for user vishal

## Create testuser2 ##
htpasswd -m /etc/svn-auth-users vyas
New password:
Re-type new password:
Adding password for user vyas

 

How to Create and configure SVN repository:-

mkdir /var/www/svn
cd /var/www/svn

svnadmin create reponame
chown -R apache.apache reponame

chcon -R -t httpd_sys_content_t /var/www/svn/reponame

## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /var/www/svn/reponame 
Goto http://localhost/svn/reponame address and you should see 
something like following, write username and password:  
 

 Create trunk, branches and tags structure under testrepo:-

Create “template” directories with following command:
mkdir -p /opt/vishal{trunk,branches,tags}
Then import template to project repository using “svn import” command:
svn import -m 'Initial import' /opt/vishal/ http://localhost/svn/repo
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:- 
 
Thanks,
Vishal Vyas