Reprint Address: http://blog.sina.com.cn/s/blog_4f072a7001015j5z.html
First, the tool download
- 01.SVN Server Subversion: Setup-subversion-1.6.17.msi
- 02.SVN Client TortoiseSVN: This article chooses the version (64-bit) Tortoisesvn-1.6.16.21511-x64-svn-1.6.17.msi
- 03.TortoiseSVN Chinese Language Pack : This article chooses version to Languagepack_1.6.16.21511-x64-zh_cn.msi
- XAMPP(apache+mysql+php integrated installation package): XAMPP version is 1.7.4
The version of Subversion and the version of TortoiseSVN are important, and not all versions can be used properly.
two. Install Xampp:
All the way next. This article installs to C:\XAMPP
three. Install Subversion:
All the way next. This article installs Subversion to the C:\Subversion\
If you have 360 security guards installed on this machine, a warning will appear, select Allow.
Iv. Configuring Apache
01, enter the Sibversion installation directory (this article is C:\Subversion\).
In order for subversion to communicate with the DAV module, the MOD_DAV_SVN plugin needs to be installed and can be found in the Subversion installation directory C:\Subversion\bin. Copy it to the Apache installation directory under the Modules folder. The next step is to configure the Apache httpd.conf file to allow Apache to load the above modules when booting.
02. Edit Apache's httpd.conf (C:\xampp\apache\conf)
Find the following:
#LoadModule Dav_module modules/mod_dav.so
Modified to:
LoadModule Dav_module modules/mod_dav.so
That is, remove the previous comment symbol "#", without the above sentence, please add it yourself. After you finish, continue adding the following:
LoadModule Dav_svn_module modules/mod_dav_svn.so
03, set the Repository directory:
In this example, I created the SVN management directory on the G disk, and I intend to place the version inventory under the G:\svn\project folder, adding the following code to the end of httpd.conf. (When copying the code, note that the "symbol is English half-width")
<Location/svn/>
DAV SVN
Svnlistparentpath on
Svnparentpath "G:/svn/project"
</location>
Restart Apache, and the local environment is complete.
Description
- <location/svn/>: The URL of the repository is http://localhost/svn/
- DAV SVN: Tells Apache which module responds to http://localhost/svn/'s request and is now the Subversion module.
- Svnparentpath "G:/svn/project": Tell Subversion to view the repository under G:/svn/project, and each subdirectory under Project is a repository. For example, there are multiple repository Repos1,repos2 under G:/svn/project, and so on, which can be accessed through Http://localhost/repos1,http://localhost/repos2.
04. Access SVN server via HTTP
Subversion operates in two ways, one based on Apache Http Server and the other as Subversion Standalone server.
Apache HTTP server is based on Apache HTTP server subversion, which does several good things:
- A. You can use the WebDAV protocol.
- B. Through the Apache HTTP way through the firewall, easy to use in the Internet environment, can use the browser as a client tool to browse the source repository.
- C. Can be easily supported to SSPI (Windows domain authentication) and LDAP (AD?). ), these are all supported by Apache itself.
- D. Can get a more complete Apache security authentication system, such as SSL encryption connection.
access the repository via browser input http://127.0.0.1/svn/( see an initial repository):
- If you follow the steps above, then, you can now achieve direct access via the browser http://127.0.0.1/svn/need to be aware of the location settings in the last to add/, should be <Location/svn/> instead of < Location/svn>
- If you want to make "HTTP://LOCALHOST/SVN" work, you need to add redirection settings to the back of </Location>: Redirectmatch ^ (/SVN) $ $1/
An initial version library
This means that Apache's DAV_SVN module is ready to function. Users can use any kind of Subversion client to access your repository via the Http protocol.
Now anyone in your repository can access it and have full write permissions. This means that anyone can read, modify, commit, and delete content from the repository anonymously.
v. Installation of TORTOISESVN:
Install Tortoisesvn-1.6.16.21511-x64-svn-1.6.17.msi and install the Chinese Language pack first Languagepack_1.6.16.21511-x64-zh_cn.msi
The software used in this article and its version
Note: If you have Kaspersky Antivirus installed on your system, be sure to set TortoiseProc.exe as a trusted program in the bin directory of the TORTOISESVN installation directory, which may cause errors when you use TORTOISESVN import to the repository feature.
Kaspersky
Six, Test svn
- Suppose you have a project workspace file in your D drive, then we create a folder with the same name under G:\svn\project: G:\svn\project\workspace
- Right-click on the G:\svn\project\workspace file,tortoisesvn-> create the Repository (Y) here (English version tortoise->create repository here)
- Then you'll see G:\svn\project\workspace inside conf, DB, hooks, lock ... such as files, the repository was created successfully.
- Returns the workspace of the D-Disk, right-click on the folder, perform tortoisesvn-> import (I) (English version is tortoise->import)
- In the dialog box that pops up, enter: http://localhost/svn/workspace/trunk/in the repository URL. The http://localhost/svn/here is the equivalent of G:\svn\project\.
- Then we remove the workspace from the D-disk and we have a good test to see if it is successful.
- In any blank folder, right click on svn Checkout (K) (English version of SVN Checkout), repository URL output http://localhost/svn/workspace/trunk/, will get workspace project source files.
About the trunk mentioned above:
In the repository of some famous open source projects, we can usually see three directories such as trunk, branches, tags and so on. Because of the inherent nature of SVN, the directory is not particularly meaningful in SVN, but these three directories exist in most open source projects ... ( detailed description )
—————————————— END ————————————————
Introduction to SVN access control:
With the relevant actions above, anyone can read, modify, commit, and delete content from the repository anonymously. Obviously, most of the occasions this is not in line with demand. So how to set the permissions, Apache provides the basic permission settings:
Configure SVN access permissionsI. Permission settings
You first need to create a user file. Apache provides a tool htpasswd for generating user files that can be found in the Apache installation directory. Here's how to use it:
01. Create the passwd file and add the user/password:
SVN access will be restricted by username/password in the passwd file.
Run->cmd into the DOS Command Action window and switch the current directory to C:\xampp\apache\bin, enter the following command:
Htpasswd-c G:\svn\project\conf\passwd username
passwd is the file name, username is your user name, according to the actual need to name, we create the file into the G:\svn\project\conf\ directory (related directory, please create it yourself). –c represents creation, and the second time you don't need to write –c. (Win platform default to password MD5 encryption)
Specific operations such as:
Create a passwd file and add a user/password
For more information about the HTPASSWD command, please use Google.
Next, modify the httpd.conf to include the following in the Location tab:
AuthType Basic
AuthName "SVN repos"
AuthUserFile "G:/SVN/PROJECT/CONF/PASSWD"
Require Valid-user
After the operation is complete, restart Apache. Open a browser to access the repository. Apache will prompt you to enter a username and password to authenticate the login, now only the users set in the passwd file can access the repository. You can also configure that only specific users can access, replacing the above "Require Valid-user" as "Require user Tony Robert" will only Tony and Robert have access to the repository.
Description
- AuthType Basic: Activate base authentication, username/password.
- AuthName "Subversion repositories": pop-up instructions for entering the authentication information box, support Chinese.
- AuthUserFile "G:/SVN/PROJECT/CONF/PASSWD": Specifies the file used to store the authenticated user name and password.
- Require Valid-user: Specifies that only users who enter the correct username/password will be able to access http://localhost/svn/normally.
Sometimes it may not be necessary to have such strict access controls, for example, most open source projects allow anonymous read operations, and only authenticated users allow write operations. For more granular permission authentication, you can use the Limit and limitexcept tags. For example, you can continue to add the following in the Location tab:
<limitexcept GET PROPFIND OPTIONS report>
Require Valid-user
</limitexcept>
As configured above will allow anonymous users to have read permissions, while restricting only users who are configured in Passwordfile can use write operations. If this does not meet your requirements, you can use Apache's MOD_AUTHZ_SVN module to authenticate each directory.
02. Establish a file that controls user access rights Authz
First you need to have Apache load the MOD_AUTHZ_SVN module in. Locate the MOD_AUTH_SVN module in the Subversion installation directory and copy it to the modules subdirectory of the Apache installation directory.
Then modify the httpd.conf file to find
LoadModule Dav_svn_module modules/mod_dav_svn.so
Add it to the back
LoadModule Authz_svn_module modules/mod_authz_svn.so
You can now use the Authz feature in the Location tab. A basic Authz configuration is as follows:
<Location/svn/>
DAV SVN
Svnlistparentpath on
Svnparentpath "g:/svn/project/"
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile "G:/SVN/PROJECT/CONF/PASSWD"
Authzsvnaccessfile "G:/svn/project/conf/authz"
Satisfy any
Require Valid-user
</location>
Description: Authzsvnaccessfile "G:/svn/project/conf/authz": Specifies the file that is used to store access control permissions for the repository.
There is no need to include <Limit> or <LimitExcept> tags in the Apache configuration file here. However, a setting of satisfy any is added, which means that when allow and require are enabled, a total of two alternate values are specified for the relevant policy, and all indicates that the user has to satisfy both the enable and require conditions, and any satisfies one of them.
Here, Satisfy any is used to allow anonymous attempts to access first, and to give access to the control of anonymous users based on Authz. Without this, anonymous users are inaccessible regardless of whether or not the "*=r" notation is added to the Authz.
Authzsvnaccessfile points to the Authz policy file, and detailed permission controls can be specified in this policy file, such as:
#两个分组: Admin Group, Developers Group
[Groups]
admin = FUCKGFW//admin
Developers = Jimmy Michel Spark Sean Steven Tony Robert//Developer
#在根目录下指定所有的用户有读权限
[/]
* = R
#追加 committers Group user has read and write access
@committers = RW
Read and Write permission for users of the specified developers group under the Branches/dev directory #在
[/branches/dev]
@developers = RW
#在 to give Tony Read and write access to the user under the/tags group
[/tags]
Tony = RW
#禁止所有用户访问/private Directory
[/private]
* =
#给 committers Group User Read permissions
@committers = R
Create a new Notepad file in g:/svn/project/, with the file name Authz, no suffix, and enter the following:
[Groups]
admin = FUCKGFW
[/]
* = R
@admin = RW
This example specifies only one administrator group, and one administrator user.
After the operation is complete, restart Apache.