Windows SVN Server build Method Defragment (Apache) _win Server

Source: Internet
Author: User
Tags character set commit svn win32 tortoisesvn
This section and you talk about Windows SVN server building problem, here to share with you, I hope to be useful.

1, software download

Windows SVN server is built to download the Subversion server program. To the official website download binary installation file, came to the binary package download section, find the windowsnt,2000,xpand2003 section, and then select "Thisdirectory" so that we can see a lot of downloaded content, Svn-1.4.0-setup.exe can now be downloaded. Download Subversion's Windows client tortoisesvn. TortoiseSVN is a set of tools for extending Windowsshell that can be viewed as a plug-in to Windows Explorer, and Windows can identify the working directory of Subversion after installation. The official website is TORTOISESVN, downloaded in the same way as the previous SVN server, on the download page we can choose to download the version, The currently highest stable version of the installation file is Tortoisesvn-1.4.0.7501-win32-svn-1.4.0.msi.

2, Server and client Installation

Windows under the SVN server build, server installation, directly run Svn-1.4.0-setup.exe, according to the prompts to install, so we have a set of servers can run the environment. Install TORTOISESVN, Also directly run Tortoisesvn-1.4.0.7501-win32-svn-1.4.0.msi follow the prompts to install, but after the final will be prompted to reboot, in fact, the restart is only to make SVN working copy in Windows Special style takes effect, with all the actual features, and here in order to immediately see To a good effect, or reboot the machine.

3, build version library (Repository)

Running a subversion server requires first establishing a version library (Repository), which can be viewed as a database of data stored on the server, and can be run directly after the Subversion server is installed, such as: Svnadmincreatee:\svndemo \repository will create a version library under the directory E:\svndemo\repository. We can also use the TortoiseSVN graphical completion of this step: in the Directory E:\svndemo\repository "right button->tortoisesvn->createrepositoryhere ...", You can then select the version library mode, which is used by default, and then creates a series of directories and files.

4, configure users and permissions

Windows SVN server to build, came to the E:\svndemo\repository\conf directory, modify svnserve.conf:
Copy Code code as follows:

#[general]
#password-db=passwd
To
[General]
PASSWORD-DB=PASSWD then modifies the passwd file in the same directory, removing the following three lines of comments:
#[users]
#harry =harryssecret
#sally =sallyssecret
Finally becomes:
[Users]
Harry=harryssecret
Sally=sallyssecret

5, running a standalone server

Run in any directory: Svnserve-d-re:\svndemo\repository our server program is already started. Be careful not to close the Command line window and close the window to stop the Svnserve.
Running in Windows services: sccreatesvnservicebinpath= "D:\PROGRAMFILES\SUBVERSION\BIN\SVNSERVE.EXE--SERVICE-RE:\SVN" Displayname= "Svnservice" Depend=tcpipstart=auto

6, initialize the import

Windows SVN server to build, come to the project we want to import the root directory, in this case is E:\svndemo\initproject, the directory has a Readme.txt file: Right button->tortoisesvn->import ...
Urlofrepository enter "svn://localhost/" OK after the directory has not changed, if there is no error, the data has been all imported into the version of the library we just defined.
It should be noted that this step can be done entirely on another host with TortoiseSVN installed. For example, the IP of the host running Svnserve is 133.96.121.22, then the content of the URL part is "svn://133.96.121.22/".

two ways to implement SVN build test server

This section and you learn how to use SVN to build a test server, there are two commonly used methods, here is a brief introduction, Welcome to join me to learn SVN build test server method.
In the regular team development process, test server testing is an essential link, how to quickly and easily deploy test server will be the focus of this article. The actual environment of this article is CENTOS+PHP+MYSQL+SVN, and there are two different ways to achieve the ultimate goal of deploying a test server. Let's take a look at SVN's first way to build a test server.
The first kind, post-commit
The post-commit itself is one of the SVN series hooks to make it easier to handle common operations in SVN usage, and the steps to establish a test server are as follows
In the hooks directory, create the Post-commit file and define its contents as similar to the following
Copy Code code as follows:

#!/bin/sh
Exportlang=en_us. UTF-8
Svncheckout--usernamekimi--passwordpasswordsvn://10.0.0.8/projects//wwwroot/projects.ismole.net
Chownwww:www/wwwroot/projects.ismole.net-rf

Description
1.#!/bin/sh description is to execute shell command
2.exportlang=en_us. UTF-8 is to solve Svnpostcommit Chinese garbled, set localization code. But SVN defaults to UTF-8 encoding. If the character set matches and is not set, an error is performed and the execution is unsuccessful, and the error is identified as Svn:can ' Tconvertstringfromnativeencodingto ' utf-8′
3.svncheckout–usernamekimi–passwordpasswordsvn://10.0.0.8/projects//wwwroot/projects.ismole.net perform the SVN checkout operation
4.CHOWNWWW:WWW/WWWROOT/PROJECTS.ISMOLE.NET-RF Change the folder owner for webserver.
The original code is all commented out. You can execute the shell command, which is invoked every time a commit completes. Let's take a look at SVN's second approach to building a test server.
the second type, PHP check out SVN
Copy Code code as follows:

<?php
Header ("Cache-control:no-cache,must-revalidate");
$handle =popen (' svncheckout--usernamekimi--passwordpasswordsvn://10.0.0.8/projects//wwwroot/projects.ismole.net ', ' r ');
$read =stream_get_contents ($handle);
echo "<pre>";
printf ($read);
echo "</pre>"
Pclose ($handle);
?>

In fact, this way is only using PHP to execute Linux commands, but more description. Reference "PHP monitoring Linux server load": http://www.ccvita.com/390.html
This combination of the two approaches is designed to be done by checking out SVN and placing it in the appropriate web directory. These two comparisons, post-commit more simple and fast, no need for more operations, but the control of the authority is very small, as long as SVN submit permissions on the deployment of the test server permissions; PHP is a bit more cumbersome, but the control of user rights can be customized to implement the program, You can achieve almost any role control over permissions.
In the actual use of the process, we currently apply to the application of the app debugging and cooperative nature of the development of the first way; If you need more control of SVN, recommend the second, can include testing, deployment, on-line and other links. In a cooperation with Sina, the use of this off-site development approach. This section explains the contents of the SVN build test server, and please pay attention to other relevant reports in this section.

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.