Skip to main content

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.

In this article we can see how to setup svn server on centos 6.

Lets start ,

Install svn server on centos 6

Update yum repositories and packages by typing the below command

[root@krizna ~]# yum update

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

Install and configure apache

Step 1 » Type the below command to install apache along with dependencies.
[root@krizna ~]# yum install httpd

Step 2 » Open the file /etc/httpd/conf/httpd.conf .
Find “#ServerName www.example.com:80″ (line no : 276 ) .
#
#ServerName www.example.com:80

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

#
#ServerName www.example.com:80
ServerName 192.168.1.2:80

Step 3 » Issue the below command to start apache service .
[root@krizna ~]# service httpd start
and type this below command to start apache service automatically while booting.

[root@krizna ~]# chkconfig --levels 235 httpd on

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

Installing svn server centos 6
If you not able to see the apache test page, Disable the firewall ( iptables ) and selinux service on your server .
Disable firewall ( Iptables ) »
[root@krizna ~]# service iptables stop
[root@krizna ~]# 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@krizna ~]# yum install subversion mod_dav_svn

Step 5 » Now create new directory for svn repository.

[root@krizna ~]# mkdir /svn

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

[root@krizna ~]# svnadmin create /svn/newrep

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

[root@krizna ~]# chown -R apache.apache /svn/newrep/
[root@krizna ~]# chcon -h system_u:object_r:httpd_sys_content_t /svn/newrep/
[root@krizna ~]# chcon -R -h apache:object_r:httpd_sys_content_t /svn/newrep/
Step 8 » Now create a password file “newrep.users” with username “krizna” by typing below command
[root@krizna ~]# htpasswd -cm /svn/newrep.users krizna
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 .

Step 10 » Restart apache service
[root@krizna ~]# service httpd restart
Step 11 » Now open your svn path http://yourserverip/repos/newrep in a browser( Ex: http://192.168.1.2/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@krizna ~]# mkdir -p /tmp/svn/{trunk,branches,tags}
[root@krizna ~]# svn import -m 'Initializing basic repository structure' /tmp/svn/ http://localhost/repos/newrep/

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

install svn server centos 6

Enjoy ..

  • Gavin

    DON’T DISABLE YOUR FIREWALL AND SECURITY PROTECTION. Learn how to fix it, instead.

  • Gavin

    DON’T DISABLE YOUR FIREWALL AND SECURITY PROTECTION. Learn how to fix it, instead.

  • Topi

    Hi, when type for the step 7 the result is this

    chcon -h system_u:object_r:httpd_sys_content_t /svn/newrep/
    chcon: failed to change context of «/svn/newrep/» to «system_u:object_r:httpd_sys_content_t»: Argumento inválido

    what can I do?

  • Topi

    Hi, when type for the step 7 the result is this

    chcon -h system_u:object_r:httpd_sys_content_t /svn/newrep/
    chcon: failed to change context of «/svn/newrep/» to «system_u:object_r:httpd_sys_content_t»: Argumento inválido

    what can I do?

    • Popcorn

      change your Selinux settings!

    • Andy Guo

      use “chcon -R –reference=/var/www/ /svn/newrep/” instead.

  • sadiq

    Authorization Required

    This server could not verify that you
    are authorized to access the document
    requested. Either you supplied the wrong
    credentials (e.g., bad password), or your
    browser doesn’t understand how to supply
    the credentials required.

  • sadiq

    Authorization Required

    This server could not verify that you
    are authorized to access the document
    requested. Either you supplied the wrong
    credentials (e.g., bad password), or your
    browser doesn’t understand how to supply
    the credentials required.

  • Ranjeet Ranjan

    How I add more user. As of now wehn I am adding additional user using htpasswd -cm /svn/newrep.users krizna old one used to update with new onew user

    • vyas

      htpasswd -m /svn/newrep.users krizna

      Use command without c. c is used first time to create file.

  • Ranjeet Ranjan

    How I add more user. As of now wehn I am adding additional user using htpasswd -cm /svn/newrep.users krizna old one used to update with new onew user

    • vyas

      htpasswd -m /svn/newrep.users krizna

      Use command without c. c is used first time to create file.

  • Rahul

    hi thanks for the information, Really appreciate you guys.

  • Rahul

    hi thanks for the information, Really appreciate you guys.

  • Peter

    Hai Krizna,

    nice post and very useful for me. But can you help me, if i want to create 1 user can manage more than one repository, what should i do in subversion.conf file? or any other way?

    Many Thanks.

  • Pingback: Repost: Install svn server on centos 6 | #blogging-at-work()

  • hikaru2838

    Hi , can you help me with this issue? I had done my task with your tutorial. Now, i create new repository newrep2. In last step, mkdir -p /tmp/svn/{trunk2,branches2,tags2} and
    svn import -m ‘Initializing basic repository structure’ /tmp/svn/ http://localhost/repos/newrep2/. But it add all folder trunk2,branches2,tags2,trunk,branches,tags. I only want to it add trunk2,branches2,tags2

  • janand anand

    Cool bro. Its working amazingly. Wonderful narration. There is only one change in the subversion.conf location for centos 7 version. It is in /etc/httpd/conf.modules.d