Outils pour utilisateurs

Outils du site


linux:subversion:creer_un_depot_svn

Ceci est une ancienne révision du document !


# Note : Voici l'emplacement des fichiers de configuration
# dav_svn.conf = /etc/apache2/mods-available/dav_svn.conf
# authz = /var/svn/MON_DEPOT/conf/authz
# svn.passwd = /var/svn/MON_DEPOT/conf/svn.passwd (! non fourni !)
# svnserve = /etc/init.d/svnserve

Création d'un dépôt (ici TON_DEPOT)

svnadmin create /var/svn/TON_DEPOT

On édite sa configuration :

nano /var/svn/TON_DEPOT/conf/svnserve.conf
svnserve.conf
  1. ### This file controls the configuration of the svnserve daemon, if you
  2. ### use it to allow access to this repository. (If you only allow
  3. ### access through http: and/or file: URLs, then this file is
  4. ### irrelevant.)
  5.  
  6. ### Visit http://subversion.tigris.org/ for more information.
  7.  
  8. [general]
  9. ### These options control access to the repository for unauthenticated
  10. ### and authenticated users. Valid values are "write", "read",
  11. ### and "none". The sample settings below are the defaults.
  12. anon-access = none
  13. auth-access = write
  14. ### The password-db option controls the location of the password
  15. ### database file. Unless you specify a path starting with a /,
  16. ### the file's location is relative to the directory containing
  17. ### this configuration file.
  18. ### If SASL is enabled (see below), this file will NOT be used.
  19. ### Uncomment the line below to use the default password file.
  20. password-db = svn.passwd
  21. ### The authz-db option controls the location of the authorization
  22. ### rules for path-based access control. Unless you specify a path
  23. ### starting with a /, the file's location is relative to the the
  24. ### directory containing this file. If you don't specify an
  25. ### authz-db, no path-based access control is done.
  26. ### Uncomment the line below to use the default authorization file.
  27. authz-db = authz
  28. ### This option specifies the authentication realm of the repository.
  29. ### If two repositories have the same authentication realm, they should
  30. ### have the same password database, and vice versa. The default realm
  31. ### is repository's uuid.
  32. realm = TITRE_DE_TON_DEPOT
  33.  
  34. [sasl]
  35. ### This option specifies whether you want to use the Cyrus SASL
  36. ### library for authentication. Default is false.
  37. ### This section will be ignored if svnserve is not built with Cyrus
  38. ### SASL support; to check, run 'svnserve --version' and look for a line
  39. ### reading 'Cyrus SASL authentication is available.'
  40. # use-sasl = true
  41. ### These options specify the desired strength of the security layer
  42. ### that you want SASL to provide. 0 means no encryption, 1 means
  43. ### integrity-checking only, values larger than 1 are correlated
  44. ### to the effective key length for encryption (e.g. 128 means 128-bit
  45. ### encryption). The values below are the defaults.
  46. # min-encryption = 0
  47. # max-encryption = 256

On crée six utilisateurs pour faire des tests sur les permissions (pour le premier, on utilise l'option -cm (qui crée le fichier), les autres fois l'option -m est suffisante)

htpasswd -cm /var/svn/TON_DEPOT/conf/svn.passwd admin1
htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd admin2
htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd user1
htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd user2
htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd lecteur1
htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd lecteur2

On configure les permissions du dépôt :

nano /var/svn/TON_DEPOT/conf/authz
authz
  1. ### This file is an example authorization file for svnserve.
  2. ### Its format is identical to that of mod_authz_svn authorization
  3. ### files.
  4. ### As shown below each section defines authorizations for the path and
  5. ### (optional) repository specified by the section name.
  6. ### The authorizations follow. An authorization line can refer to:
  7. ### - a single user,
  8. ### - a group of users defined in a special [groups] section,
  9. ### - an alias defined in a special [aliases] section,
  10. ### - all authenticated users, using the '$authenticated' token,
  11. ### - only anonymous users, using the '$anonymous' token,
  12. ### - anyone, using the '*' wildcard.
  13. ###
  14. ### A match can be inverted by prefixing the rule with '~'. Rules can
  15. ### grant read ('r') access, read-write ('rw') access, or no access
  16. ### ('').
  17.  
  18. [aliases]
  19. # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
  20.  
  21. [groups]
  22. # harry_and_sally = harry,sally
  23. # harry_sally_and_joe = harry,sally,&joe
  24.  
  25. # [/foo/bar]
  26. # harry = rw
  27. # &joe = r
  28. # * =
  29.  
  30. # [repository:/baz/fuz]
  31. # @harry_and_sally = rw
  32. # * = r
  33.  
  34. [/]
  35. admin1 = rw
  36.  
  37. [/Projet1/code]
  38. visiteur1 = r
  39. admin2 = rw
  40. dev1 = rw
  41.  
  42. [/VieUniversEtLeReste]
  43. utilisateur42 = rw
# On configure le Path (chemin) du depot et on indique quels sont les fichiers authz et passwd grace au fichier dav_svn.conf (! fichier dispo avec le tuto !)
nano /etc/apache2/mods-available/dav_svn.conf
# On donne recursivement acces a tout les depots svn pour l'utilisateur svn (il faudra le refaire a chaque ajout d'un nouveau depot !)
chown -R svn: /var/svn
# On donne les droits a apache sur le repertoire pour pouvoir publier le depot et acceder aux fichiers de configuration
chown -R www-data:www-data /var/svn/
# Le tout en une seule commande : 
chown -R svn: /var/svn && chown -R www-data:www-data /var/svn/
# On redemarre apache et svn pour qu'ils rechargent leurs configuration et prennent en compte nos changements
/etc/init.d/svnserve restart && /etc/init.d/apache2 restart && /etc/init.d/mongrel_cluster restart

Le dépôt est accessibles sur http://TONDOMAIN/svn_TONDEPOT

A VOIR : http://www.fr.sysadmin-cookbook.net/subversion

linux/subversion/creer_un_depot_svn.1744469371.txt.gz · Dernière modification : 2025/04/12 14:49 de tutospisto