What is Subversion used to build a large SNV platform in Linux? Subversion is a free/open-source version control system. That is to say, under Subversion management, files and directories can go beyond time and space. That is, the Subversion allows you to recover data to an earlier version, or check the data modification...
Build a large SNV platform in Linux
What is Subversion?
Subversion is a free/open-source version control system. That is to say, under Subversion management, files and directories can go beyond time and space. That is, Subversion allows you to recover data to an earlier version or check the data modification history. Because of this, many people regard the version control system as a magic "Time Machine ".
The version library of Subversion can be accessed over the network, so that users can operate on different computers. To some extent, allowing users to modify and manage the same group of data in their respective spaces can promote team collaboration. Because modifications are no longer carried out in a single line, the development speed will be faster. In addition, because all the work has been finalized, you do not have to worry about the impact on software quality due to incorrect changes-if an incorrect change occurs, you only need to cancel the change operation.
Some version control systems are also software configuration management (SCM) systems. these systems are specially designed to manage the source code tree and have many features related to software development-for example, supports programming languages or provides program building tools. However, Subversion is not such a system. It is a general system that can be managedAnyType file set. For you, these files may be source programs, but for others, they may be a cargo list or a digital movie.
Features of Subversion
We often use Subversion to describe the features of version control. If you are not familiar with CVS, it is difficult to understand the features of all subversions. If you are not familiar with version control at all, you will only be stunned. Therefore, you 'd better read Chapter 1 first.Basic conceptsThis chapter briefly introduces some basic concepts and concepts of version control.
Subversion support:
Versionized Directory
CVS can only track the change history of a single file, but the "virtual" version-based file system implemented by Subversion can track changes to the directory tree. In Subversion, the fileAndDirectories are all versionized.
Real Version history
Because you can only track changes to a single file, CVS cannot support common operations such as file copying and renaming-these operations change the contents of the Directory. Similarly, in CVS, files under a directory have the same history as long as their names are the same, even if these files of the same name have no relationship in history. In Subversion, you can add, copy, and rename files or directories, and solve the historical connection between objects with the same name and no relation.
Atomic commit
A series of related changes are either submitted to the version library or none. In this way, the user can make the relevant changes into a logical whole to prevent only some modifications from being submitted to the version Library.
Versionized metadata
Each file and directory has its own set of properties-keys and their values. You can create and store any key/value pairs as needed. Like the content of the file, the attributes are also under version control.
Optional network layer
Subversion has a high degree of abstraction in the implementation of version library access, which facilitates people to implement a new network access mechanism. Subversion can be embedded into Apache as an extension module. This method has great advantages in stability and interactivity. you can directly use the mature server technology-authentication, authorization, and transmission compression. In addition, Subversion itself implements a lightweight, standalone server software. This server uses a custom protocol that can be easily encapsulated using SSH.
Consistent data operations
Subversion uses a binary difference algorithm to describe the changes in a file. it operates in the same way as a text (readable) or binary (unreadable) file. These two types of files are compressed and stored in the version library, while the differential information is transmitted in two directions on the network.
Efficient Branch and tag operations
In Subversion, the overhead of branch and label operations is independent of the project size. Subversion branch and label operations use a mechanism similar to hard link to copy the entire project. Therefore, these operations usually only take a small and relatively fixed period of time.
Modifiable
Subversion has no historical burden. it is implemented in a series of high-quality shared C library methods and has well-defined APIs. This makes Subversion very easy to maintain and highly interoperable with other languages.
Subversion architecture
The "Subversion architecture" provides the "top view" of the Subversion design ".
Figure 1. Subversion architecture
In the figure, one end is the Subversion version database that stores all version data, and the other end is the Subvesion client program, which manages the local projection of all version data (called "working copy "), there are various version library access (RA) layers between these two poles. some use computer networks to access the version Library through network servers, while some bypass network servers to access the version library directly.
Subversion components
The installed Subversion consists of several parts. The following describes these components. The description below may be too simple and hard to understand, but don't worry-it will be used in later chapters of this bookMoreTo elaborate on these components.
Svn
Command line client program.
Svnversion
This tool is used to display the working copy status (in terms of the current project revision ).
Svnlook
Directly view the tool of the Subversion Library.
Svnadmin
Create, adjust, and fix the Subversion Library.
Svndumpfilter
A tool used to filter data streams in the Subversion database.
Mod_dav_svn
A plug-in of the Apache HTTP server, allowing the version library to be accessed over the network.
Svnserve
A separate server program can be called as a daemon or by SSH. This is another way to make the version library accessible through the network.
Svnsync
A program that uses the network incremental image version Library.
If the installation of Subversion has been completed correctly, we can start our learning journey. In the next two chapters, we will explain how to use the Subversion client programSvn.
Service configuration
The version library of a Subversion can run on the same machine as the client at the same time and use file: // for access. However, a typical Subversion setting should include a separate server, can be accessed by all clients in the office-or possibly the whole world.
This section describes how to expose a version library of Subversion to a remote client. we will overwrite the existing server mechanism of Subversion and discuss various configuration and usage methods. After reading this section, you can decide which network settings you need and understand how to configure on your host.
Overview
The Subversion design includes an abstract network layer, which means that the version library can be accessed through various server processes, and the "version library access" API of the client allows programmers to write related protocol plug-ins. Theoretically, subversion can be implemented using an infinite number of network protocols. Currently, there are only two types of servers in practice.
Apache is the most popular web server.Mod_dav_svnModule, Apache can access the version library, and the client can use the HTTP Extension Protocol WebDAV/DeltaV for access, because Apache is a very easy to expand web server, it provides many "easy to get" features, such as encrypted SSL communication, log integration with third-party tools, and built-in version library web browsing features.
In another cornerSvnserve: A smaller, lightweight server program that uses a custom protocol with the client. Because the protocol is specially designed for Subversion and is stateful (unlike HTTP), it provides faster network operations-but there are also some costs. It only understands the authentication of the CRAM-MD5, but it is very easy to configure and is the best choice for small teams that start using Subversion.
The third option is to use SSH to connect the package.Svnserve, Although this scenario is still usedSvnserve, It works with the traditionalSvnserveThe deployment is very different. SSH uses encryption in many communications, and SSH also uses Exclusive authentication (SvnserveDifferent from that, it contains its own private user account) must have a real system account. Finally, because these configurations require each user to initiate a private temporarySvnserveProcess, which is equivalent to allowing a group of local users to access through the file: // protocol (from the perspective of access permission ). Therefore, path-based access control becomes meaningless because each user can directly access the version Library.
The following is a summary of the three typical server deployments.
Table 6.1.
Features |
Apache + mod_dav_svn |
Svnserve |
Svnserve over SSH |
Authentication options |
HTTP (S) basic auth, X.509 certificates, LDAP, NTLM, or any Apache httpd method |
CRAM-MD5 |
SSH |
User account options |
Private 'users' file |
Private 'users' file |
System account |
Authorization options |
You can grant read/write permissions to the entire version library or specify the directory. |
You can grant read/write permissions to the entire version library or specify the directory. |
Only the read/write permissions can be granted to the version database. |
Encryption |
Use optional SSL |
None |
SSH channel |
Logging |
Completely record Apache logs for each HTTP request, and record common client operations with the option "advanced. |
No logging |
No logging |
Interactivity |
It can be partially used by other WebDAV clients. |
Communicate with svn clients only |
Communicate with svn clients only |
Web browsing capability |
Limited built-in support, or third-party tools such as ViewVC |
Only third-party tools, such as ViewVC |
Only third-party tools, such as ViewVC |
Speed |
Slow |
Faster |
Faster |
Initial settings |
Complicated |
Extremely simple |
Relatively simple |
The above is taken from the Subversion manual.
This article describes only the complete SVN solution for using Apache http service in SVN, including version library management for multiple projects, SSL encryption, web interface management projects, and user password storage for mysql.
Okay. start to study hard ~
I. environment description
Server: CentOS 5.5 IP: 10.1.254.241
Client: Win2003 IP: 10.1.96.9
II. installation of software packages
1,
[Root @ subversion-1 ~] # Yum-y install mysql-server mysql-devel per-DBI perl-DBD-MySQl mod_auth_mysql php-common Php-cli php http-devel mod_sslsubversion subversion-devel subversion-perl mod_dav_svn php-mysql
Mod_auth_mysql saves the username and password to the MySQL database and then directly uses them for authentication.
Mod_dav_svn Apache maintains the configuration instructions of the Subversion repository through the Apache HTTP Server.
2. check whether the subversion is successfully installed.
[Root @ subversion-1 ~] # Svnserve -- version
Svnserve, version 1.6.11 (r93411)
Compiled Jun 8 2011 16:21:54
3. configure mysql
1. create an account
GRANT all privileges ON *. * TO usvn @ localhost identified by 'usvn ';
4. configure the svn hypervisor usvn
: Http://subversion.tigris.org/downloads/subversion-1.6.11.tar.gz
1. program environment requirements
1) PHP 5 (5.1.2 <= ver <5.3)
2) apache2
3) mod_dav enable (in Apache httpd. conf-DSO support-"LoadModule dav_module modules/mod_dav.so ")
4) mod_dav_fs enable (in Apache httpd. conf-DSO support-"LoadModule dav_fs_module modules/mod_dav_fs.so ")
5) mod_rewrite enable (in Apache httpd. conf-DSO support-"LoadModule rewrite_module modules/mod_rewrite.so ")
6) proper AllowOverride configuration (see below example-"AllowOverride All ")
7) Subversion-below modules are packed in most binary distributions
8) mod_authz_svn enable (in Apache httpd. conf-DSO support-"LoadModule authz_svn_module modules/mod_authz_svn.so ")
9) mod_dav_svn enable (in Apache httpd. conf-DSO support-"LoadModule dav_svn_module modules/mod_dav_svn.so ")
2. decompress the package to/var/www/html/usvn.
3. configure apache and httpd. conf to add the following lines and comment out Listen 80.
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule ssl_module modules/mod_ssl.so
Alias/usvn/var/www/html/usvn/public/
Options + SymLinksIfOwnerMatch
AllowOverride all
Order allow, deny
Allow from all
4. After apache is started, check whether https port 443 is enabled. you can use secure http ssl to transmit data.
[Root @ subversion-1 ~] # Netstat-antp | grep 443
Tcp 0 0: 443: * LISTEN 4239/httpd
Do not forget to modify the firewall to allow access to port 443 of the local machine
5. enter the address http: // 10.1.254.241/usvn/in the browser/
Add the preceding configuration to the end of httpd. conf and restart. Next, you can use usvn to manage subversion.
5. simple usvn
1. log on to the console, and create a project.
2. click "Manage" to add a new project.
3. add a project user and click "Manage"-"user"-"add a new user ".
4. log on to the client to install TortoiseSVN.
Http://tortoisesvn.net/downloads.html. after the installation is complete, select checkout on the right.
Of course, you can also browse through https
You can also log on to usvn to browse
The usage is not described here.
6. problems encountered during httpd installation and php compilation and solutions
1. to use usvn, pay attention to the PHP version 5.1.2 <= ver <5.3. httpd should set module mod_rewrite, mod_dav mod_ssl
2. Apache-related software package apr-util httpd can be obtained from the http://lab.renren.com
Subversion pack http://subversion.apache.org/download/#pre-releases
3. Compile the following code:
? Install apr-1.4.5
./Configure
Make & make install
? Install apr-util
/Configure -- with-apr =/usr/local/apr
Make & make install
? Install httpd
./Configure -- prefix =/usr/local/httpd-2.2.192 \
-- Enable-rewrite \
-- Enable-dav \
-- Enable-so \
-- Enable-maintainer-mode \
-- Enable-ssl \
-- With-apr =/usr/local/apr/bin/apr-1-config \ -- with-apr-util =/usr/local/apr/bin/apu-1-config & make install
? Install subversion
./Configure
-- Prefix =/usr/local/subversion-1.6.11 \
-- With-apxs =/usr/local/httpd/bin/apxs \
-- With-apr =/usr/local/apr \
-- With-apr-util =/usr/local/apr & make install
? Install php
./Configure -- prefix =/usr/local/php \
-- With-apxs2 =/usr/local/httpd/bin/apxs \
-- With-config-file-path =/usr/local/php \
-- With-mysql =/usr/local/mysql -- with-freetype-dir \
-- With-gd -- with-jpeg-dir -- with-curl -- with-png-dir \
-- With-zlib -- enable-mbstring \
-- Enable-exif \
-- With-openssl & make install
? Install mysqli
Cd/mysql-ser/ext/mysqi/
/Usr/local/php/bin/phpize (generate configure file)
./Configure \
-Prefix =/usr/local/mysqli \
-With-php-config =/usr/local/php/bin/php-config \
-With-mysqli =/usr/local/mysql/bin/mysql_config & make install
Add the mysqli. so module in/usr/local/php. ini.
Extension_dir = "/path/to/mysqli. so/dir". The Directory of the mysqli. so file is displayed after the installation is complete.
Extension = mysqli. so
4. error solution
? An error occurred while compiling mysqli. so.
Vi/usr/local/mysql/include/mysql. h
In row 221st
......
Enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
/*
There are three types of queries-the ones that have to go
The master, the ones that go to a slave, and the adminstrative
Type which must happen on the specified connectioin
*/
# Add the following four rows
Enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
2. if the following error occurs:
/Root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c: In function 'zif _ mysqli_stmt_bind_param ':
/Root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c: 144: error: 'gptr 'undeclared (first use in this function)
/Root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c: 144: error: (Each undeclared identifier is reported only once
/Root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c: 144: error: for each function it appears in .)
/Root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c: In function 'zif _ mysqli_stmt_execute ':
/Root/tmp/php-5.2.3/ext/mysqli/mysqli_api.c: 603: error: 'gptr 'undeclared (first use in this function)
Make: *** [mysqli_api.lo] Error 1
Modify this file.
Vi mysqli_api.c
Find all gptr with rows 144, rows 150, rows 603, and rows 607 replaced by char *.
? The type = innodb error occurs in step 6 of usvn. replace the type = innodb file with engine = innodb because the new mysql version does not support the type command.
Okay. take a rest.
This article is from the "Zhu Jianyue-focus, professional" blog