SVN for apache2 (1)

Source: Internet
Author: User
Tags http authentication net bug tortoisesvn

The most common configuration mode of SVN is integration with Apache, so that SVN can provide services through the webdev protocol. The main benefits include: using Apache to penetrate the firewall through http to facilitate use in the Internet environment, providing directory version control, and comparing files in pure binary format. The following describes how to integrate SVN into Apache.

  1. Preparations:

    1. Download Software:

      1. SVN ServerProgram. ToOfficial WebsiteTo download the binary Installation File.Binary Package download, Find Windows NT, 2000, XP and 2003, and then select"This directory", So we can see a lot of downloaded content. Currently, you can downloadSvn-1.2.3-setup.exe.

      2. Tortoisesvn, Client program. Tortoisesvn is a tool that extends Windows Shell and can be seen as a plug-in for Windows resource manager. After installation, Windows can identify the working directory of subversion.
        The official website isTortoisesvnThe download method is similar to that of the svn server.DownloadSelect the official version for Win2k/XP or higher version on the page, andDownload PageSelect the TortoiseSVN-1.2.5.4719-svn-1.2.3.msi of the installation files for the current highest stable version. (Note: tortoisesvn has a version with a special bug fix for vs. Net runtime.Download PageAvailable options: special version for Win2k/XP or higher:(We provide no support for this !)Uses _ SVN folders instead of. SVN to work around the Vs. net bug with web projects. If you don't use web projects then please use the official version .)
      3. Chinese Language Pack for tortoisesvnNote that the version must be the same as that of the client. You canDownloadSelect to download the language packs on the page.
      4. Apache server program. You can go to the Apache official website to download the latest version of Apache, and SVN must run in apache2 or later versions, on the download page select Windows installation package file apache_2.0.55-win32-x86-no_ssl.msi
      5. AnkhsvnOptional. Install the svn plug-in for vs. net. You can select versions 0.5 and 0.6. Version 0.6 supports vs2005 beta2 and the download page.
    2. Stop IIS. Because Apache is installed on port 80 by default, You need to disable IIS to avoid port conflict. You can adjust the port after installing it.

  2. Start installation:
    1. Install the Apache server first. When you enter serverinfo, if the Active Directory is enabled on the machine, the installer will automatically enter it; otherwise, you can manually enter it. After the installation is complete, go to the installation directory and find httpd In the conf directory. in the config file, search for listen, change 80 after listen to 8080 (or the desired port), and restart the Apache server. In this case, you can use http: // localhost: 8080 to test whether the installation is correct.

    2. There is nothing to say about installing the svn server. Just press Enter. (When installing SVN, make sure that the Apache server is running. Apache may be shut down and restarted during installation)
  3. Configure Apache server and SVN integration:

    1. First, the Subversion installation directory bin \ contains two files:Mod_authz_svn.soAndMod_dav_svn.soCopy to the modules \ directory of the Apache installation directory.
    2. SomeArticleModify httpd. conf and make the following changes:
      Find the conf directory under the Apache installation directory, open httpd. conf in the text editor, and find the following two lines:

      # Loadmodule dav_module modules/mod_dav.so
      # Loadmodule dav_fs_module modules/mod_dav_fs.so

      Remove the annotator "#" before each line. Add the following lines at the end of all loadmodule statements:

      # SVN
      Loadmodule dav_svn_module modules/mod_dav_svn.so
      Loadmodule authz_svn_module modules/mod_authz_svn.so

      However, after I installed the file, I found that the file has been modified. The new version of the svn installer has been optimized. In fact, after successful installation of SVN, the Apache server has been initially integrated with SVN.

      Note that the following status bar is already Apache/2.0.55 svn1.2.3 Dav/2

    3. Create a directory where SVN stores files. I will create a folder under drive F:/subversionfiles
    4. Next, we must tell Apache the path of our resource library. You can use the location command to complete this setting. Because we do not want to set each project separately, we store all the projects in the same resource library directory. We can use the svnparentpath command to specify the path for storing all projects. Add the following configuration at the end of the httpd. conf file:

      # SVN

      <Location/SVN>
      Dav SVN
      Svnparentpath "F:/subversionfiles"
      </Location>

    In this way, you can use http: // myhost: 8080/SVN/<Project Name> to access the specified project in the F:/subversionfiles resource library. Of course, you may not want a project to provide such an access method. In this case, you can use svnpath to set each project separately. The svnpath usage is as follows:

    Dav SVN
    Svnpath "F:/subversionfiles/project1"

    Put this configuration item at the end of httpd. conf. Restart the Apache HTTP service to access the resource library of the project1 project through http: // myhost: 8080/SVN/project1.

    1. The following is a test:

      1. Create a sub-directory test under F: \ subversionfiles and run svnadmin create F: \ subversionfiles \ test in the bin directory of aapche.

      2. Open the browser and enter the URL: http: // localhost: 8080/SVN/test. You should be able to access it correctly. However, no content is added to the current project, so it is displayed as blank

      3. One thing to note is that the current access is completely anonymous and anyone can operate on SVN. Therefore, we will use Apache's permission management function to integrate user verification for SVN.

    2. Add User Authentication:

      Before determining the permission Control for access users, you must plan whether to perform uniform authentication for all projects in the entire resource library or a single project, that is to say, we mentioned the problem of using svnparentpath or svnpath.

      The simplest authentication method is to use the basic HTTP authentication mechanism, which authenticates the access user through the user name and password. We can directly set it through the support provided by Apache. Apache provides an htpasswd tool to manage user names and passwords. Next we will use this tool to add two users.

      In the command line window, go to the directory where Apache is located and execute the following command

      Note: Create the user xrinehart
      Input: htpasswd-C f: \ subversionfiles \ svn_auth_passwd xrinehart
      Creates a passwd file using the-C parameter.
      Output:
      New Password :*****
      Re-type new password :*****
      Adding password for user xrinehart

      When creating a user, the-C parameter is not used, but the-M parameter is used, because the fileSvn_auth_passwdCreated.

      Open the svn_auth_passwd file, and the password is encrypted using MD5, and the contents encrypted by the same password are different.

      Next, we must tell the Apache server how to use the passwd file, open httpd. conf, find the location where the location configuration we just added, and modify it as follows:

      #
      # SVN
      #

      Dav SVN
      Svnparentpath "F:/subversionfiles"

      # How to authenticate a user
      Authtype basic
      Authname "Subversion repository"
      Authuserfile "F:/subversionfiles/svn_auth_passwd"

      # Only Authenticated Users may access the Repository
      Require valid-user


      Restart the Apache HTTP Server and open http: // localhost: 8080/SVN/test in the browser. You will see the login request dialog box. Enter the username and password you just set.

      In this way, the integration of Apache and SVN is basically achieved.

      Related Articles: SVN for apache2 (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.