My linux world » Subversion

Subversion


Prerequiste

I assume that you have a Centos installation.

Installation

You can copy/paste this script and use it to configure automatically your server.
If wget failed, you can download svnindex files from here

  1. #!/bin/bash
  2.  
  3. echo "install tools subversion, mod_dav_svn"
  4. dnf -y install subversion mod_dav_svn
  5.  
  6. echo "create trees in /opt/svn"
  7. mkdir -p /opt/svn/repos
  8. mkdir -p /opt/svn/bin
  9. mkdir -p /opt/svn/conf
  10.  
  11. echo "create sample of svn access file (/opt/svn/conf/dav_svn.authz)"
  12. cat > /opt/svn/conf/dav_svn.authz << "EOF"
  13. [groups]
  14. staff = joe, george
  15.  
  16. [/]
  17. * = rw
  18.  
  19. [framework:/]
  20. john = r
  21. @staff = rw
  22. EOF
  23.  
  24.  
  25. echo "configure httpd (create /etc/httpd/conf.d/svn.conf)"
  26. cat > /etc/httpd/conf.d/svn.conf << "EOF"
  27. LoadModule dav_svn_module modules/mod_dav_svn.so
  28. LoadModule authz_svn_module modules/mod_authz_svn.so
  29.  
  30. <Location /svn/>
  31. # Load subversion mod
  32. DAV svn
  33.  
  34. # Subversion configuration
  35. SVNParentPath /opt/svn/repos
  36. SVNListParentPath On
  37. SVNIndexXSLT "/svnindex.xsl"
  38.  
  39. Options Indexes MultiViews IncludesNoExec
  40.  
  41. AuthzSVNAccessFile /opt/svn/conf/dav_svn.authz
  42. AuthType Basic
  43. AuthName "Subversion repos"
  44. #Require valid-user
  45. Require all granted
  46. </Location>
  47. EOF
  48.  
  49. echo "get svnindex file from here: http://code.google.com/p/tortoisesvn/source/browse/trunk/contrib/svnindex/"
  50. cp /usr/share/doc/subversion-1.7.14/xslt/svnindex.xsl /var/www/html
  51. cp /usr/share/doc/subversion-1.7.14/xslt/svnindex.css /var/www/html
  52. chown apache:apache /var/www/html/ -R
  53.  
  54. echo "create /opt/svn/bin/create.sh"
  55. cat > /opt/svn/bin/create.sh << "EOF"
  56. svnadmin create /opt/svn/repos/$1
  57. chown -R apache:apache /opt/svn/repos/$1
  58. chmod -R 750 /opt/svn/repos/$1
  59. EOF
  60. chmod a+x /opt/svn/bin/create.sh
  61.  
  62. echo "create a sample repository named 'myrepos'"
  63. /opt/svn/bin/create.sh myrepos
  64.  
  65. echo "set authz on /opt/svn"
  66. chown apache:apache /opt/svn/ -R
  67.  
  68. echo "Now restart httpd"
  69. systemctl restart httpd.service
  70.  
  71. myip=`hostname -I`
  72. echo "Now meet you there: http://$myip/svn/"
  73.  

That’s all 🙂
Administration – svn

FAQ

Need some help? Have a look here: Subversion Survival Guide


Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.