How To Configure SVN Server In RHEL 6.. & Centos 6..

Subversion is a free/open-source version control system. Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine”.

Server System Details-

OS-               RHEL 6.3

Step-1- Change Hostname-

[root@server ~]# vim /etc/sysconfig/network

[root@server ~]# vim /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6         server

Step-2 Change IP

[root@server ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0


Restart Network Services..

[root@server ~]# service network restart

Check Hostname..

[root@server ~]# hostname

Check IP..

[root@server ~]# ifconfig

Step-3 Install SVN Package..

[root@server ~]# yum install -y subversion mod_dav_svn

(If you haven’t install apache already the above command will install it respectively.)

Step-3 Configure SVN Server.
Edit this file..

[root@server ~]# vim /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/
LoadModule authz_svn_module   modules/
#Add the following lines

DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /etc/svn-auth-users
Require valid-user

# containing Subversion repositories, "/var/www/svn".  Each repository
# must be both:
#   a) readable and writable by the 'apache' user, and
#   b) labelled with the 'httpd_sys_content_t' context if using
#   SELinux
# Example configuration to enable HTTP access for a directory


Step-4 Add SVN (Subversion) users

[root@server ~]# htpasswd -cm /etc/svn-auth-users ashu

New password:
Re-type new password:
Adding password for user ashu

Note- 'ashu' is a svn user..

Step-5 Create and configure SVN repository

[root@server ~]# mkdir /var/www/svn
[root@server ~]# cd /var/www/svn/
[root@server svn]# svnadmin create svn_repo
[root@server svn]# chown -R apache.apache svn_repo/

Step-6 Enabled SELinux..

[root@server svn]# chcon -R -t httpd_sys_content_t /var/www/svn/svn_repo/
[root@server svn]# chcon -R -t httpd_sys_rw_content_t /var/www/svn/svn_repo/

Check Open or not Apache default port 80, through iptables.

[root@server svn]# vi /etc/sysconfig/iptables-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT

Step-7 Restart and Save Iptables..

[root@server svn]# /etc/init.d/iptables restart

iptables: Flushing firewall rules:                                  [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                                      [  OK  ]
iptables: Applying firewall rules:                                  [  OK  ]

Step-8 Restart httpd Service..

[root@server svn]# /etc/init.d/httpd restart
[root@server svn]# chkconfig httpd on

Step- 9 SVN Server Configuration has been completed..Now access the SVN Server...

Open Browser (Google-Chrome or Mozilla)

And Type..

*How To Disable anonymous access..

[root@server ~]# vim /var/www/svn/svn_repo/conf/svnserve.conf

# Line no 12 - Uncomment and Change to 'none'
anon-access = none
# Line No 27 - Uncomment to enable acess control
authz-db = authz

*How To Create additional links(directories) under Subversion Repository.

[root@server ~]# mkdir subversion-templates
[root@server ~]# cd subversion-templates/
[root@server subversion-templates]# mkdir linux-software
[root@server subversion-templates]# mkdir ashu

Now import the sub directories using the command ‘svn import’.

[root@server ~]# svn import -m 'Initial import' subversion-templates/

Adding         subversion-templates/updates
Adding         subversion-templates/softwares
Adding         subversion-templates/fixes
Committed revision 2.

Now Again Check..

Now newly created directory structure will be listed under your main repository...



Click Back..                                Click Home..