📜 ⬆️ ⬇️

Installing and configuring SVN, Apache, Trac for Windows. Part 2 - Apache and SVN

Back to: Part 1 - SVN ...
In this part:

Install Apache

  1. Run apache_2.0.63-win32-x86-openssl-0.9.7m.msi
  2. enter the initial settings
    Initial data for installing Apapche
  3. choose the type of installation Custom
    Choose the type of installation Apapche
  4. specify the installation directory C: \ usr \ local \ Apache2
    Select the installation directory Apapche
    The directory is selected correctly
    Apapche installation directory
  5. wait until the end of the installation.

Connecting SVN to Apache

  1. Copy from the C: \ usr \ local \ Subversion \ bin \ directory to the C: \ usr \ local \ Apache2 \ modules \ directory all the * .so, * .dll files
    • intl3_svn.dll
    • libapr.dll
    • ...
    • ssleay32.dll
    • mod_authz_svn.so
    • mod_dav_svn.so

Configuring Apache to work with SVN

We configure SVN for work with several storages at once.

Setup:

  1. Create the directory C: \ usr \ local \ Apache2 \ conf \ svn \ and create the file httpd-svn.conf in it with the following content:
    	 # httpd-svn.conf SVN Config file
    	 #
    	 # Connect modules for working with SVN
             LoadModule dav_module modules / mod_dav.so
    	 LoadModule dav_svn_module modules / mod_dav_svn.so
    	 LoadModule authz_svn_module modules / mod_authz_svn.so
    	
    	 <Location / svn>
    	 DAV svn
    	 # Absolute path to the directory containing the SVN repository
      	 SVNParentPath "D: / repos"
    	 # lists the repositories
    	 SVNListParentPath on
    	 # storage list design file
    	 SVNIndexXSLT "/svnindex.xsl"
    
      	 # file ACL access control to storage
    	 # uncomment to use
      	 AuthzSVNAccessFile conf / svn / svnaccess
    
      	 # only authenticated users will have access to the repository
      	 Require valid-user
    
      	 # Authentication Type
      	 AuthType Basic
    	 # General name of the repository
      	 AuthName "My SVN Repository"
    	 # File with user passwords for access to SVN repository
      	 AuthUserFile conf / svn / svnpasswd
    
    	 </ Location>
    	
  2. change directory C: \ usr \ local \ Apache2 \ conf \
  3. open the httpd.conf file and add the following lines to the end of the file:
    	 # Subversion system
    	 include conf / svn / httpd-svn.conf
    	
  4. save the file and close it.
In the directory C: \ usr \ local \ Apache2 \ htdocs \ copy the files:To access, enter the name guest and leave the password blank.

Create svnpasswd password file


The first way is using the svnuser.bat script.

  1. Open notepad and copy the following code.
     @echo off
     if% 1 == "" goto USAGE
    
     if not exist svnpasswd htpasswd -cm svnpasswd% 1
     if exist svnpasswd htpasswd -m svnpasswd% 1
     goto EXIT
    
     : USAGE
     echo Create SVN access file
     echo Usage: svnuser username 
    
     : EXIT
    
  2. Save the file with the name
      svnuser.bat 
    to the C: \ usr \ local \ Apache2 \ bin \ directory
  3. run a command prompt and go to the directory C: \ usr \ local \ Apache2 \ bin \
  4. add users one by one using the command
      svnuser name 
    , the program will ask for a password - enter it.
  5. In the directory C: \ usr \ local \ Apache2 \ bin \ you will find the file created with the passwords svnpasswd
  6. copy the file to the C: \ usr \ local \ Apache2 \ conf \ svn \ directory

The second way is manually

  1. Open command prompt
  2. change directory C: \ usr \ local \ Apache2 \ bin \
  3. to add users who have access to the repository, run for each user command
      htpasswd svnpasswd user1 passwd_for_user1 
  4. In the directory C: \ usr \ local \ Apache2 \ bin \ you will find the file created with the passwords svnpasswd
  5. copy the file to the C: \ usr \ local \ Apache2 \ conf \ svn \ directory
Note
htpasswd requires the -b switch for each run (so that the password can be entered from the command line) and -c for the first run to create a password file


Configuring SVN Authorization by Path (Path-Based Authorization)


In SVN there is an opportunity to delimit the areas of user access. A special format file is created in which we indicate the paths available to users. I will give an example.
In the list we have 3 storages: RepA, RepB, ​​docs. And 3 users: oleg, ira, sveta.
')
We divide users into groups:
Attention! Comments in the file are not allowed, so do not forget to delete them!
 [groups]
 admins = oleg // group administrators, write oleg      
 devteam = ira, oleg // main project development team
 editors = @devteam, sveta // users writing documentation
 // previously described user groups can be included in the subsequent ones
 // when linking to a group @ group_name is used

We indicate who can see the listing of available repositories.
By default, we allow everyone to view. The rule applies to nested vaults! A group of administrators allow editing of files and vault settings.
 [/]
 * = r
 @admins = rw

RepA repository access.
From the root element, the rule applies here to allow viewing to all (* = r), however, some users need to deny access to this repository, this can be done by writing the user name with an empty access modifier value. We prohibit the user oleg access to the repository, and ira will get full control as a developer.
 [RepA: /]
 oleg = // subtract all permissions, null
 ira = rw // read, write

Access RepB repository.
We prohibit the user ira access to the repository, and oleg will get full control as a developer.
 [RepB: /]
 ira =
 oleg = rw

Access to the document repository.
Permit full access to the editors documentation team.
 [docs: /]
 @editors = rw


As a result, we get the configuration file for authorization svnaccess .
 [groups]
 admins = oleg
 devteam = ira, oleg
 editors = @devteam, sveta

 [/]
 * = r
 @admins = rw

 [RepA: /]
 oleg =
 ira = r

 [RepB: /]
 ira =
 oleg = r

 [docs: /]
 @editors = rw
 anonymous = r


Copy the created svnaccess file to the C: \ usr \ local \ Apache2 \ conf \ svn \ directory

Restart the Apache server
Open a browser and enter http: // localhost / svn /

The browser will ask you for the name and password you specified earlier in the file.
C: \ usr \ local \ Apache2 \ conf \ svn \ svnpasswd ,
enter them and you will see the list of storages store1, store2

Next to: Part 3 - Trac ...

Source: https://habr.com/ru/post/53753/


All Articles