Install SVN (Subversion) Server on Fedora 20/19, CentOS/Red Hat (RHEL) 6.5/5.10

Do you like this?

82

 
 
 

This is guide, howto install SVN (Subversion) server on Fedora 20/19/18/17/16/15/14, CentOS 6.5/6.4/6.3/6.2/6.1/6/5.10, Red Hat (RHEL) 6.5/6.4/6.3/6.2/6.1/6/5.10.

What is SVN (Subversion)?

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”.

 

Install SVN (Subversion) Server on Fedora 20/19/18, CentOS 6.5/5.10, Red Hat (RHEL) 6.5/5.10

1. Change root user

  1. su -
  2. ## OR ##
  3. sudo -i
 

2. Install needed packages (mod_dav_svn and subversion)

  1. yum install mod_dav_svn subversion

Note: If you don’t have Apache installed already, this command installs it also. Read more about installing Apache and PHP >>

 

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

Add following config to /etc/httpd/conf.d/subversion.conf file:

  1. LoadModule dav_svn_module modules/mod_dav_svn.so
  2. LoadModule authz_svn_module modules/mod_authz_svn.so
  3.  
  4. <Location /svn>
  5. DAV svn
  6. SVNParentPath /var/www/svn
  7. AuthType Basic
  8. AuthName "Subversion repositories"
  9. AuthUserFile /etc/svn-auth-users
  10. Require valid-user
  11. </Location>

Read more SVN Access Control >>

 

4. Add SVN (Subversion) users

Use following command:

  1. ## Create testuser ##
  2. htpasswd -cm /etc/svn-auth-users testuser
  3. New password:
  4. Re-type new password:
  5. Adding password for user testuser
  6.  
  7. ## Create testuser2 ##
  8. htpasswd -m /etc/svn-auth-users testuser2
  9. New password:
  10. Re-type new password:
  11. Adding password for user testuser2

Note: Use exactly same file and path name as used on subversion.conf file. This example use /etc/svn-auth-users file.

Read more SVN Access Control >>

 

5. Create and configure SVN repository

  1. mkdir /var/www/svn
  2. cd /var/www/svn
  3.  
  4. svnadmin create testrepo
  5. chown -R apache.apache testrepo
  6.  
  7.  
  8. ## If you have SELinux enabled (you can check it with "sestatus" command) ##
  9. ## then change SELinux security context with chcon command ##
  10.  
  11. chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
  12.  
  13. ## Following enables commits over http ##
  14. chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

Restart Apache:

  1. ## Fedora ##
  2. systemctl restart httpd.service
  3. ## OR ##
  4. service httpd restart
  5.  
  6. ## CentOS / RHEL ##
  7. /etc/init.d/httpd restart
  8. ## OR ##
  9. service httpd restart

Goto http://localhost/svn/testrepo address and you should see something like following, write username and password:

SVN testrepo revision 0:

 

6. Configure repository

To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

  1. ## Disable anonymous access ##
  2. anon-access = none
  3.  
  4. ## Enable access control ##
  5. authz-db = authz

7. Create trunkbranches and tags structure under testrepo

Create “template” directories with following command:

  1. mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Then import template to project repository using “svn import” command:

  1. svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
  2. Adding /tmp/svn-structure-template/trunk
  3. Adding /tmp/svn-structure-template/branches
  4. Adding /tmp/svn-structure-template/tags
  5.  
  6. Committed revision 1.

Check results on browser and see testrepo revision 1:

 

Remember also take regular backups. Here is guide howto backup and restore SVN (Subversion) Repositories.

 

Our forums user Will have also written guide, howto to install and configure SVN (Subversion). This is little bit different method.

Follow If Not True Then False Updates!
 

280 COMMENTS

  1. Akhil / August 25, 2013

    Hi JR

    I am getting httpd unpacking error while trying to installmod_dav_svn.on centOS 6.4

    Running Transaction
    Installing : subversion-1.6.11-9.el6_4.x86_64 1/3
    Installing : httpd-2.2.15-29.el6.centos.x86_64 2/3
    Error unpacking rpm package httpd-2.2.15-29.el6.centos.x86_64
    warning: /etc/httpd/conf/httpd.conf created as /etc/httpd/conf/httpd.conf.rpmnew
    warning: /etc/httpd/conf/magic created as /etc/httpd/conf/magic.rpmnew
    error: unpacking of archive failed on file /etc/httpd/logs: cpio: rename
    Installing : mod_dav_svn-1.6.11-9.el6_4.x86_64 3/3
    Verifying : mod_dav_svn-1.6.11-9.el6_4.x86_64 1/3
    Verifying : subversion-1.6.11-9.el6_4.x86_64 2/3
    Verifying : httpd-2.2.15-29.el6.centos.x86_64 3/3

    Installed:
    mod_dav_svn.x86_64 0:1.6.11-9.el6_4 subversion.x86_64 0:1.6.11-9.el6_4

    Failed:
    httpd.x86_64 0:2.2.15-29.el6.centos

     
    • JR / September 8, 2013

      Hi Akhil,

      Could you post output of following commands:

      1. ls -la /etc/httpd
      2.  
      3. ls -la /etc/httpd/logs
       
  2. Jirong Hu / September 19, 2013

    I followed your articles to install my SVN server with Apache2 successfully. Now I want to enable https. Do you have some instructions like this?

     
    • JR / September 20, 2013

      Hi Jirong Hu,

      Do you want use self-signed SSL certificate or commercial SSL certificate?

       
  3. sinhatpro / October 12, 2013

    Hi JR

    I’m post some step then I to do. Please help me a sulotion for error :

    DAV svn
    SVNParentPath /var/www/svn
    AuthType Basic
    AuthName “Subversion repositories”
    AuthUserFile /etc/apache2/dav_svn.passwd
    AuthzSVNAccessFile /etc/apache2/mods-enabled/dav_svn.authz
    Require valid-user

    5. Create Repository for test:
    mkdir /var/www/svn

    6. Authencation for user access forder
    svnadmin create myproject
    chown -R www-data myproject

    7. Create username
    htpasswd -cm /etc/sapache2/dav_svn.passwd testuser1
    htpasswd -m /etc/apache2/dav_svn.passwd testuser2

    9. Configure file dav_svn.authz control access for every user.
    [groups]
    testuser1
    testuser2

    [myproject:/]
    testgroup1 = rw
    testuser2 = r

     
    • JR / October 15, 2013

      Hi sinhatpro,

      I read your both comments and looks like you don’t have myproject2 just only myproject?

      Then also your dav_svn.authz file groups is missing group names, you only list testuser1 and testuser2, then you set rw permission to testgroup1.

      But yes you are right, it’s not SELinux problem, because you are using Ubuntu…

       
  4. zinger / October 16, 2013

    If step 5 fails with message

    chcon: can't apply partial context to unlabeled file

    do these commands instead


    chcon -h system_u:object_r:httpd_sys_content_t /var/www/svn/testrepo
    chcon -R -h apache:object_r:httpd_sys_content_t /var/www/svn/testrepo/*

     
  5. edivaldo / October 16, 2013

    I’m not getting add.

    for example:

    [cit@Ltv10 repos]$ svn add test.txt
    svn: ‘.’ is not a working copy

    [cit@Ltv10 repos]$ svn status
    svn: warning: ‘.’ is not a working copy

    [cit@Ltv10 repos]$ svn commit
    svn: ‘/var/www/svn/repos’ is not a working copy

    But,

    [cit@Ltv10 repos]$ sudo svn co http://localhost/svn/repos/
    [sudo] password for cit:
    A repos/trunk
    A repos/branches
    A repos/tags
    Checked out revision 1.


    follown my file subversion.config:

    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so

    DAV svn
    SVNParentPath /var/www/svn
    SVNPathAuthz off

    Do you can help me?

    TKS,

     
    • JR / October 22, 2013

      Hi edivaldo,

      You can’t add files or do anything if you have not working copy.

      What happens after checkout, if you run:

      1. svn status
       
  6. Shaikh Zahid Hossain / October 30, 2013

    I am following this step but Last IMPORT command Not relocalted

    root@atomix# svn import -m ‘Initial import’ /tmp/svn-structure-template/ http://114.134.91.91/svn/testrepo/
    Authentication realm: Subversion repositories
    Password for ‘root’:
    Authentication realm: Subversion repositories
    Username: sk
    Password for ‘sk’:
    svn: Repository moved permanently to ‘http://114.134.91.91/svn/testrepo/’; please relocate
    [root@atomix ~]#

    Can’t import “trunk,branches,tags”
    pls help any one

     
    • JR / November 1, 2013

      Hi Shaikh Zahid Hossain,

      Could you post your config files example to http://pastebin.com

      And output of following commands here:

      1. ls -ladZ /var/www/svn
      2.  
      3. ls -laZ /var/www/svn

      I assume here, that you have used /var/www/svn location for repos.

       
  7. Adi / December 11, 2013

    Hi JR,

    First of all I wann thank you for your useful blog.

    I have same issue as Max.

    I have tried below two commnads

    1. chcon -R -t httpd_sys_content_t /var/www/svn/repository

    Above commnad went through fine

    2. chcon -R -t httpd_sys_rw_content_t /var/www/svn/repository

    This Command Gave me Error:

    chcon: failed to change context of /var/www/svn/repository to system_u:object_r:httpd_sys_rw_content_t: Invalid argument
    chcon: failed to change context of /var/www/svn/repository/format to system_u:object_r:httpd_sys_rw_content_t: Invalid argument

    Then I tried the commands as suggested to MAX

    1. chcon -h system_u:object_r:httpd_sys_rw_content_t /var/www/svn/repository

    Error: chcon -h system_u:object_r:httpd_sys_rw_content_t /var/www/svn/repository
    chcon: failed to change context of /var/www/svn/repository to system_u:object_r:httpd_sys_rw_content_t: Invalid argument

    2. chcon -R -h apache:object_r:httpd_sys_rw_content_t /var/www/svn/repository/*

    Error: chcon -R -h apache:object_r:httpd_sys_rw_content_t /var/www/svn/repository/*
    chcon: failed to change context of /var/www/svn/repository/conf to apache:object_r:httpd_sys_rw_content_t: Invalid argument
    chcon: failed to change context of /var/www/svn/repository/conf/authz to apache:object_r:httpd_sys_rw_content_t: Invalid argument

    My Machine details:

    uname -a
    Linux adc6140502 2.6.18-164.0.0.0.1.el5xen #1 SMP Wed Sep 2 22:48:20 EDT 2009 i686 i686 i386 GNU/Linux

    lsb_release -a
    LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
    Distributor ID: EnterpriseEnterpriseServer
    Description: Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)
    Release: 5.4
    Codename: Carthage

    rpm -qa coreutils\* selinux\* |sort
    coreutils-5.97-23.el5
    selinux-policy-2.4.6-255.el5
    selinux-policy-devel-2.4.6-255.el5
    selinux-policy-minimum-2.4.6-255.el5
    selinux-policy-mls-2.4.6-255.el5
    selinux-policy-strict-2.4.6-255.el5
    selinux-policy-targeted-2.4.6-255.el5

    Please help

     
  8. Achintya Mondal / January 21, 2014

    how to log out in my account

     
  9. Steve / January 30, 2014

    First off thanks for the directions. I’m up and running but having an issue on commit:
    In my checked out dir, I first did an ADD for a bunch of new files and directories. svn status reports ok that files are ready to add. Upon attempting my first commit I get:

    svn: Commit failed (details follow):
    svn: Server sent unexpected return value (503 Service Temporarily Unavailable) in response to PROPFIND request…

    when I did all of your steps I did as my own user but sudo’ed to root.
    I did checkout, add, and attempting commit as my own user ‘steve’. All files and directories in my checked out dir are permissioned for me.

    Been googling around on this error and can’t find a solutions for my case. Please help.

     
    • JR / March 7, 2014

      Hi Steve,

      When you checkout repo example over http, then you can use repo as any user. Did you added your user and password AuthUserFile? If you use exactly this guide then you have to do commits as testuser and use testuser password.

      Could you also check what errors you see on httpd access and erros logs?

       
  10. Yusof / March 4, 2014

    I think this one is important too, to start your SVN services

    svnserve -d -r /var/www/svn

     
  11. Vasu / March 6, 2014

    Thanks People for this useful blog. I could install SVN in my Linux server successfully but when I try to launch it through console (http://localhost/svn/testrepo) I get login screen but the credentials fail. I gave testuser as the login, similar to the example given above. Sucessful Users, Please advice.

     
    • JR / March 7, 2014

      Hi Vasu,

      Did you used exactly same password that you used on step 4.?

      You could of course create some other user, set password and try again.

       
  12. Vasu / March 7, 2014

    Thanks for replies.. Yes, I used the same password, even i tried by creating another and using it. It didnt work..

    I came across a file in net /etc/svn-access-control . Should we do any changes into svn-access-control file for making the credentials work..?

     
    • JR / March 7, 2014

      Excellent, just want to first make sure that there wasn’t any mistake on users or passwords…

      So do you have enabled SVN Access Control?

      If yes, could you then post content of /etc/httpd/conf.d/subversion.conf and /etc/svn-access-control files?

       
  13. Vasu / March 10, 2014

    How can we enable SVN Access Control..? Please find below /etc/svn-access-control File for your reference.

    [groups]
    testgroup = testuser1, testuser2
    testgroup2 = testuser3, testuser4, testuser5
    testgroup3 = testuser6, testuser7

    [/]
    * = r
    @testgroup = rw
    testuser4 = rw

    [testrepo:/]
    @testgroup2 = rw
    testuser6 = rw

    [testrepo2:/trunk]
    @testgroup3 = rw
    testuser5 = rw

    [testrepo2:/tags]
    @testgroup3 = r
    testuser5 = rw

     
  14. Vasu / March 10, 2014

    Also please let me know the purpose of authz and passwd files under /var/www/svn/testrepo/conf

    It contains Username and passwords.. Do we need to enter into it.?

     
    • JR / March 11, 2014

      Hi Vasu,

      Could you post content of following files /etc/httpd/conf.d/subversion.conf and testrepo/conf/svnserve.conf, example to http://pastebin.com

      Normally it’s better test installation without access control to make sure, where the problem is. If basic setup is not working, then it’s wise to try fix it first without any additional configurations.

       
  15. Vasu / March 11, 2014

    Good Morning..:)
    Please find content of /etc/httpd/conf.d/subversion.conf below

    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so

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

    testrepo/conf/svnserve.conf Content is
    anon-access = none
    autzh-db = authz
    [general]
    anon-access = read
    auth-access = write
    password-db = passwd
    authz-db = authz

    I also want to know from which file the credentials are loaded while we login…..

     
  16. Vasu / March 12, 2014

    People, the issue is resolved by changed two files like below:

    /etc/svn-access-control data:

    [groups]
    testgroup = testuser,testuser1,testuser2,testuser3,testuser4

    [/]
    * = rw
    @testgroup = rw

    [testrepo:/]
    @testgroup = rw

    [testrepo:/trunk]
    @testgroup = rw

    [testrepo:/branches]
    @testgroup = rw

    [testrepo:/tags]
    @testgroup = rw

    Type the below commands to add Users:

    htpasswd -cm /etc/svn-auth-users testuser2
    New Password:
    Retype Password:

    This encrypts and stores password and username at /etc/svn-auth-users file

     
 

Leave a Comment

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

Name *

Email *

Website

Comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Trackbacks/Pingbacks

  1. Install SVN Server on Fedora 13/14, CentOS/Red Hat (RHEL) 5.5/6 « svn - [...] Więcej: Install SVN Server on Fedora 13/14, CentOS/Red Hat (RHEL) 5.5/6 [...]
  2. Install SVN (Subversion) Server on Fedora 15/14, CentOS/Red Hat (RHEL) 5.6/6 | 資訊與工作 - [...] Install SVN (Subversion) Server on Fedora 15/14, CentOS/Red Hat (RHEL) 5.6/6 Install SVN (Subversion) Server on Fedora 15/14, CentOS/Red

Install SVN (Subversion) Server on Fedora 20/19, CentOS/Red Hat (RHEL) 6.5/5.10的更多相关文章

  1. Install Oracle Java JDK/JRE 7u55 on Fedora 20/19, CentOS/RHEL 6.5/5.10

    What’s new in Sun/Oracle Java 7 VM Compressed 64-bit object pointers Garbage-First GC (G1) JSR 292: ...

  2. Install MySQL 5.7 on Fedora 25/24, CentOS/RHEL 7.3/6.8/5.11

    MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user ...

  3. Fedora CentOS Red Hat中让vim支持语法高亮设置

    Fedora / CentOS / Red Hat这三个系统里默认的vi是没有语法高亮显示的,白色的字体看起来很不舒服. 首先用命令行cat /etc/os-release查看当前linux系统的类型 ...

  4. Unix/Linux环境C编程入门教程(19)Red Hat Entetprise Linux 7.0环境搭建

    位架构,包括英特尔X-86_64.Power和s390.动态定时能力将降低内核内部中断数量,Open vSwitch 2.0功能可调节虚拟机之间的流量.RHEL 7中默认的文件系统是XFS,包含了一个 ...

  5. Install Percona XtraDb Cluster 5.6.20 on CentOS 6.5

    http://blog.51cto.com/hj192837/1546149 You should have odd number of real nodes. node #1hostname: pe ...

  6. SQL Server on Red Hat Enterprise Linux——RHEL上的SQL Server(全截图)

    本文从零开始一步一步介绍如何在Red Hat Enterprise Linux上搭建SQL Server 2017,包括安装系统.安装SQL等相关步骤和方法(仅供测试学习之用,基础篇). 一.   创 ...

  7. SQL Server on Red Hat Enterprise Linux

    本文从零开始一步一步介绍如何在Red Hat Enterprise Linux上搭建SQL Server 2017,包括安装系统.安装SQL等相关步骤和方法(仅供测试学习之用,基础篇). 一.   创 ...

  8. Install Oracle 10g on Red Hat Linux 5.3 Step by Step

    一.虚拟机配置 1. 虚拟机(VBox 4.3.12) 2. 配置虚拟机网卡网络.选择host-only.VirtualBox Host-Only Network网卡IP为设置为192.168.1.1 ...

  9. Red Hat Enterprise 7.5 安装后无法进入图形界面 This system is not registered with an entitlement server. You can use subscription-manager to register.

    This system is not registered with an entitlement server. You can use subscription-manager to regist ...

随机推荐

  1. [置顶] 九度笔记之 1494:Dota

    题目1494:Dota 1 秒 内存限制:128 兆 特殊判题:否 提交:559 解决:122 题目描述: 大家都知道在dota游戏中,装备是对于英雄来说十分重要的要素. 英雄们不仅可以购买单个的装备 ...

  2. 得到Revit子窗体

    start /// <summary> /// 得到主窗体句柄 /// </summary> /// <returns></returns> publi ...

  3. iOS7中的多任务 - Background Fetch,Silent Remote Notifications,Background Transfer Service

    转自:http://onevcat.com/2013/08/ios7-background-multitask/ 在IOS 7 出来不就,公司内部也组织了一次关于IOS 7 特性的的分享,今天看见on ...

  4. jQuery Ajax 上传文件夹及文件

    我们先来看一下文件夹结构 这是上传处理的: 看一下系统日志: 升级 HTML5文件实现拖拽上传提示效果改进(支持三种状态提示) 拖拽过程详解: 1:文件未拖出文件选择框的时候提示:将要上传的文件或文件 ...

  5. 都铎王朝第一至四季/全集The Tudors迅雷下载

    都铎王朝 第一.二.三.四季 The Tudors Season (2007-2010) 本季看点:本剧讲述了年轻的亨利八世对英国的统治以及他的婚姻生活,带有传奇色彩.Showtime电视台的古装热门 ...

  6. ios之网络异常与正常视图的切换

    1. xib中创建两个View 2. View的视图大概如下第一个:View View 第二个:View 3. 代码切换: [self.view addSubview:_redView];  // 会 ...

  7. Android让手机主动亮屏的代码

    我们在做电子阅读器的时候可能会要求屏幕保持常亮,不希望它熄灭.它的原理也是利用系统服务,来操纵底层设备. 一.系统服务——PowerManager PowerManager.java就是管理我们电源方 ...

  8. 《精通Oracle SQL(第2版) 》

    <精通Oracle SQL(第2版) > 基本信息 作者: (美)Karen Morton    Kerry Osborne    Robyn Sands    Riyaj Shamsud ...

  9. 《例说XBee无线模块开发》

    <例说XBee无线模块开发> 基本信息 原书名:The Hands-on XBee Lab Manual:Experiments that Teach you XBee Wireless ...

  10. 修改服务的运行权限,解决SVN Post Commit问题

    先来看一下错误现象 之前在Windows Server中安装了VirtualSVN Server,然后设置了Post Commit Hooks,在提交代码到版本库之后,将代码check到本地的一个Se ...