Install Svn in Windows

Source: Internet
Author: User
Tags ultraedit tortoisesvn

SVN installation in windows I. preparations:
1. HTTP server: official website of apache2.x is http://httpd.apache.org/
2. SVN: the official website is http://subversion.tigris.org/
3. ClientProgram(Optional): tortoisesvn (if you want to use this tool to create a database, note that the version should be the version supported by the svn server)

Ii. installation:
1. the Apache server can be installed normally. If port 80 is in use, you can temporarily stop services (such as IIS) corresponding to port 80 to avoid port conflict during installation ). After the installation is complete, you can modify the Apache port by modifying the listener in httpd. conf of Apache.
2. SVN: the installation is simple and one way to next.
3. Client Program (optional): tortoisesvn. Restart after installation.

Iii. Configuration:
1. First copy the mod_authz_svn.so and mod_dav_svn.so files under the Subversion installation directory bin \ To the modules \ directory of the Apache installation directory, and then copy all the files under the Subversion installation directory bin. copy the DLL file to the bin \ directory of the Apache installation directory.
2. Modify 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
3. Create a directory where SVN stores files, for example, D: \ svnrepo.
4. 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
Svnlistparentpath on
Svnparentpath "D:/svnrepo"
# Svnpath "D:/svnrepo/test"

#################### Authentication Type
Authtype basic
################### Authentication Name, displayed in the logon prompt box
Authname "Subversion resource library. Please log on! "
################### Which password file to use for authentication
Authuserfile D: \ svnrepo \ passwd
################### Restrict the Directory Access Permissions of each user or group in the version Library
Authzsvnaccessfile D: \ svnrepo \ svnaccessfile
################### Grant all users the read permission on the version database and only specific users have the write permission.
Require valid-user
</Location>

4. Add users:
Open the command line tool (cmd.exe) and go to the bin directory of Apache. refer to the following command to add users.
Description: Creates a user named ZJ.
Input: htpasswd-c d: \ svnrepo \ passwd ZJ
Creates a passwd file using the-C parameter.
Output:
New Password :*****
Re-type new password :*****
Adding password for user ZJ
When creating a user, the-C parameter is not used, but the-M parameter is used, because the file passwd has been created.
5. Create SVN resource library:
Use tortoisesvn to create a test resource library under D:/svnrepo. Here, note the following problem: If the version of tortoisesvn is too high and the version of SVN server is too low, the created resource library cannot be accessed (SVN cocould not open the requested SVN filesystem ). Therefore, the version must be consistent.
Of course, to avoid the above problems, you can also use commands to create them. In the command line window, go to the svn bin,
Svnadmin create d: \ svnrepo \ Repository
6. configure access permissions:
Create a file named svnaccessfile under D: \ svnrepo and write the following content:
[Groups]
Admin = ZM
Team1 = dev1, dev2

# Specify default access rules for all databases
# Everyone can read and the administrator can write data. dangerous elements do not have any permissions. [/] indicates the root directory.
[/]
* = R
@ Admin = RW
Dangerman =

# Allow developers to have full access to their project version Libraries
[Test:/]
@ Team1 = RW

 

Configure the svn Server
Open the/CONF/directory of each SVN repository, open svnserve. conf, and find the following two sentences:

# [General]

# Anon-access = none

# Auth-access = write
# Password-DB = passwd

# At the beginning of each line, anon-access = none is inaccessible to anonymous users, and a user name and password are required. (Note: This is the problem. You must note that the format cannot be blank after the comment is removed)

The second row specifies the authentication file name, that is, the passwd file.
Open the passwd file and set

# [Users]
# Harry = harryssecret
# Sally = sallyssecret

The beginning of these lines # characters are removed. This is set to a user. One row is stored in the format of "username = password". For example, you can insert a row: Admin = admin888, add a user with the username admin and password admin888 to the system.

Configure the authz File

Svnserve-based servers and FAQs about authz configuration of permission files
Recently I have been using subversion forums (http://www.iUseSVN.com/bbs) to address the following issues:
Why does my client have no write permission?
Why does my permissions not work?

Summarize their configurations and find
Svnserve is used as the server,
Both use the authz-DB option in svnserve. conf.

The possible causes are as follows:

1. When configuring authz, do not pay attention to the directory specified by the svnserve startup parameter-R.
There are two cases:
A:-R is directly specified to the version Library (called the single-database svnserve method)
For example, there is a library project1 located at D: \ SVN \ project1
Run the following command to start svnserve
[Copy to clipboard] [-] Code:
Svnserve-D-r d: \ SVN \ project1
In this case, a svnserve can only work for one version Library
If the authz file is configured as follows, this is an error,

[Copy to clipboard] [-] Code:
[Groups]
Admin = user1
Dev = user2
[Project1:/]
@ Admin = RW
@ Doc = r
It should be configured

[Copy to clipboard] [-] Code:
[Groups]
Admin = user1
Dev = user2
[/]
@ Admin = RW
@ Doc = r
Because [project1:/] indicates the root directory of the Project 1 database, there is no concept of a database based on the preceding startup parameters.
Use a URL like this: SVN: // 192.168.0.1/to access project1.

B:-r specifies the parent directory of the version Library (called the multi-database svnserve method)
Similarly, there is a library project1 located at D: \ SVN \ project1
If you use the following command to start svnserve

[Copy to clipboard] [-] Code:
Svnserve-D-r d: \ SVN
In this case, a svnserve can work for multiple version libraries,
In this case, if you want to restrict the specified directory of the specified database, you should specify a specific library, such

[Copy to clipboard] [-] Code:
[Groups]
Admin = user1
Dev = user2
[Project1:/]
@ Admin = RW
@ Doc = r
If you still use [/], it indicates the root directory of all databases. Similarly, [/src] indicates the src directory under the root directory of all databases.
Use a URL like this: SVN: // 192.168.0.1/project1 to access project1
You can access project2 with the following url: SVN: // 192.168.0.1/project2:

2. When permission control is performed on the Chinese directory, the permission file authz is not changed to UTF-8 format.

SVN uses UTF-8 encoding for non-English file names and directory names. correct control of Chinese directories is required,
How to convert the default file to UTF-8 In the UTF-8 format without Bom,
I am using the ultraedit menu "ASCII to UTF-8 (UNICODE editing )". In the configuration of ultraedit, you can set whether a BOM exists.

VII. Test
Restart Apache and access http: // localhost: Port/SVN/in IE/
See the created test resource library for permission test. If an access failure occurs, check whether the path set by location in the conf file of Apache is missing/or the NTFS directory permission is incorrect.

Run SVN Server
Run SVN Service
Execute

Svnserve -- daemon -- root F: \ lava \ SVN
Service start, -- daemon can be abbreviated to-D, -- root can be abbreviated to-R, you can create a batch processing file and put it in the Windows Startup Group to run the svn service at startup (note: this is a temporary open service, the window cannot be closed after the command is executed), or in this address http://clanlib.org /~ MBN/svnservice/downloads the svnservice.exe file, copies it to the E: \ SVN \ bin directory, and then runs it from the command line:

Svnservice-install -- daemon -- root "E: \ SVN \ repository"
SC config svnservice start = auto
Net start svnservice

You can use the background service to set Automatic execution upon startup.

D: \ Program Files \ subversion \ bin> SC create svnservice binpath = "D: \ Program Files \

Subversion \ bin \ svnserve.exe -- service-r f: \ SVN"

You can use net svnservice stop or start to start the service, or you can start it in sevices. MSC.

 

Add as System Service
Method 1 (recommended ):
In Windows NT (including Windows XP, Windows 2000, and Windows 2003 Server), a tool for installing services is included, which is called "service control" and also supports SC .exe.
1. Install as a service:
For example, my subversion is installed in "D: \ Program Files \ subversion", and the version library is in "D: \ svn_root". I want the corresponding subversion service name to be svnservice, the command for installing the svn service can be written as follows:
SC create svnservice
Binpath = "D: \ Program Files \ subversion \ bin \ svnserve.exe -- service-r d: \ svn_root"
Displayname = "svnservice"
Depend = TCPIP
Note that the preceding command is divided into multiple lines, but it should be in one line during actual execution. In addition, the "-d" option, that is, the daemon mode, is used when svnserve is started previously. It cannot be used here, and the service cannot be started. Similarly, the "-I" and "-T" options cannot be used.
There are two other points to be handled with caution. First, if the path contains spaces, you must use "\" to process the "signature number. If svnserve.exe is in" C: \ Program Files \ subversion, the command should be written as "binpath =" \ "C: \ Program Files \ subversion \ bin \ svnserve.exe \" (Content in ""). The entire command is as follows, the red part is the changed part:
SC create svnservice
Binpath = "\" D: \ Program Files \ subversion \ bin \ svnserve.exe \ "-- service-r d: \ svnroot"
Displayname = "svnservice"
Depend = TCPIP
SC also requires the option format. For example, "depend = TCPIP" cannot be written as "depend = TCPIP" or "depend = TCPIP ", that is, there must be spaces before "=.
2. Start the service
After the command is executed in the command line window, the service has not been started. You can continue to run "Net start svnservice" to start the service.
3. Stop the service
Use "net stop svnservice" to stop the service.
4. delete a service
If there is a problem with the service installation, you may need to delete the service. To delete the previously added service, Run "SC Delete svnservice". "svnservice" is the name we used when creating the service.
5. The configuration service is automatically started.
By default, the installed Service will not start with windows. To enable the svn service to start with windows, you need to modify the "SC create" command (Delete first ), add the "Start = auto" option:
SC create svnservice
Binpath = "D: \ Program Files \ subversion \ bin \ svnserve.exe -- service-r d: \ svn_root"
Displayname = "svnservice"
Depend = TCPIP
Start = auto
Of course, you can also use graphical tools to modify Service Attributes. You can run "services. msc" in "start-> Run..." And then modify the Service Attributes on the interface.
Method 2:
Create a batch file and place it in the Windows Startup Group to run the svn service at startup.
Method 3:
This address http://clanlib.org /~ MBN/svnservice/downloads the svnservice.exe file, copies it to the E: \ SVN \ bin directory, and then runs it from the command line:
Svnservice -- install -- daemon -- root "E: \ SVN \ repository"
SC config svnservice start = auto
Net start svnservice
This file turns SVN into a service in windows and is automatically started by default. Note: When you execute the third sentence, make sure that the svn service that was previously run in the command line mode has been stopped, if the task is not stopped, press Ctrl + C in the window to stop the task.

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.