How to Install svn server on centos 6

SVN – Apache subversion

SVN – Subversion is a versioning and revision control system used by developers to track and keep up earlier versions of their source codes.

Update yum repositories and packages by typing the below command

[root@24x7 ~]  yum update

Before installing SVN packages, you must install and configure apache ( Webserver ) .

» Type the below command to install apache along with dependencies.

[root@24x7 ~]  yum install httpd

» Open the file /etc/httpd/conf/httpd.conf .
Find “#ServerName www.24x7ss.com:80″

 #ServerName www.24x7ss.com.com:80

and add this line below . “ServerName youripaddress:80″

 #ServerName www.24x7ss.com:80
ServerName 192.168.1.2:80  

 » Issue the below command to start apache service .

[root@24x7 ~]  service httpd start

and type this below command to start apache service automatically while booting.

[root@24x7 ~]   chkconfig --levels 235 httpd on

Now open your server ip address in the browser . you can see the apache test page.

If you not able to see the apache test page, Disable the firewall ( iptables ) and selinux service on your server .
Disable firewall ( Iptables ) »

[root@24x7ss ~] # service iptables stop
[root@24x7ss ~] # chkconfig iptables off

Disable Selinux » open the file /etc/selinux/config and find the line

  SELINUX=enforcing 

and replace with

  SELINUX=disabled 

now reboot the server and try again.

Install and configure svn server
Step 4 » Now start installing svn packages, Just type the below command .

[root@24x7ss ~] # yum install subversion mod_dav_svn

Step 5 » Now create new directory for svn repository.

[root@24x7ss ~] # mkdir /svn

Step 6 » Create a new repository in the svn by issuing the below command

[root@24x7ss ~] # svnadmin create /svn/newrep

Step 7 » Now issue the below commands one by one for necessary permissions.

[root@24x7ss ~] # chown -R apache.apache /svn/newrep/
[root@24x7ss ~] # chcon -h system_u:object_r:httpd_sys_content_t /svn/newrep/
[root@24x7ss ~] # chcon -R -h apache:object_r:httpd_sys_content_t /svn/newrep/

Step 8 » Now create a password file “newrep.users” with username “24x7ss” by typing below command

[root@24x7ss ~] # htpasswd -cm /svn/newrep.users 24x7ss

Step 9 » Now open the SVN apache config file ( /etc/httpd/conf.d/subversion.conf ) and add the below lines at the end of the file .

 DAV svn
 SVN path
 SVNParentPath /svn
 AuthType Basic
 AuthName "Authorization Realm"
 password file path
 AuthUserFile /svn/newrep.users
 Require valid-user
 
 
 DAV svn
 SVN path
 SVNParentPath /svn
 AuthType Basic
 AuthName "Authorization Realm"
 password file path
 AuthUserFile /svn/newrep.users
 Require valid-user

» Restart apache service

[root@24x7ss ~]# service httpd restart

Step 11 » Now open your svn path http://yourserverip/repos/newrep in a browser( Ex: http://192.168.2.1/repos/newrep ) . you can see newrep revision page after typing username and password created (step 8).

install svn server centos 6
Step 12 » Create basic repository structure with the below commands

[root@24x7ss ~] # mkdir -p /tmp/svn/{trunk,branches,tags}
[root@24x7ss ~] # svn import -m 'Initializing basic repository structure' /tmp/svn/ http://localhost/repos/newrep/

Step 13 » Now you can see updated revision and structure details .

By anup

Leave a Reply

Your email address will not be published. Required fields are marked *