What is SVN
SVN is the abbreviation for Subversion, is an open source version control system, compared to RCS, CVS, it uses the branch management system, its design goal is to replace CVS. Many version control services on the Internet have migrated from CVs to subversion.
1. Improved performance. SVN regardless of whether the file is a text or binary type, internal is the binary difference comparison algorithm to represent the update part of the file. This means that all files are stored in a file library in the form of differences. and the transmission on the network, is the small file difference part. This also enables operations such as branching, tagging, merging, and so on, to be done very quickly.
2. The organization of the directory is more easily managed. SVN does not only track the files, it also makes versions of the directories. Therefore, the directory structure can be modified at any time according to the needs of the project, and the existing directory can be moved to a new place.
3. Guarantee the integrity of the commit operation. SVN handles the commit operation like a database transaction, either all succeeds or all is invalid, guaranteeing atomicity.
SVN configuration
Mount/dev/cdrom/media/cdrom Mount Optical Drive
1. Install the SVN server side
Yum install subversion download from image install SVN server side
cd/usr/local///Enter directory, ready to create SVN directory
mkdir SVN//Create an SVN directory
Chmod-r 777 SVN//Modify directory permissions to 777
Svnadmin Create/usr/local/svn/linux//Create an SVN version repository sunny (sunny can name it casually)
CD svn/linux/conf//Enter the configuration file directory under the sunny repository
Below to modify the three configuration files in this directory
(1) VI svnserve.conf//configuration repository information and user file and user password file path, repository path
Put
Anon-access = none//change to None 12
auth-access = Write 13
Password-db = passwd 18
Realm = Linux//change to your own version library 30
Save
(2) vi Authz//files, creating permissions for SVN Group and group users
[Group]
Linux = PCY,TRP//Create a sunny group and specify two users GEP and WCE
[/]//define permissions under the root directory
@linux = RW//sunny Group user rights are read and write
* = r//other users have read access only
Save exit
(3) VI passwd//Create or modify user passwords
[Users]
Pcy = 123456//user named GEP has a password of 123456
TRP = 123456//...
Save exit
Start SVN:
Svnserve-d-r/usr/local/svn///A multi-version library is used here to start if a single version of the library can be svnserve-d-r/usr/local/svn/sunny
Add a row
Then you set the self-start
Vi/etc/rc.d/rc.local opening a self-boot file to add
/usr/bin/svnserve-d-r/usr/local/svn/
At this end, you can check out files from the server.
SVN command:
NETSTAT-TNL |grep:3690 See if SVN starts
PS aux |grep ' svn ' Find all SVN-initiated processes
Kill-9 2505 kills 2505 of this found SVN process
To make a checkout, first set up a folder in the root directory to place the files to be checked out
Check Out command:
SVN checkout svn://linux ip/repository name/directory path to check out
Example: SVN checkout SVN://192.168.1.107/SVN (established directory)/aaa (file directory to check out)
If you are creating a new folder, you must first add the file
SVN Add new File
The second part is to submit
SVN commit-m "comment" xxx.php//Submit File
[[Email protected] aaa]# svn commit-m "AAAAAAAAAAAA" a.php
New a.php
Transfer file data.
The revised version after submission is 1.
Third
Two users edit at the same time the third one has to be edited
Then we need svn up to take out the latest version of the edit file
Common commands:
SVN up//update file
SVN commit-m "comment" xxx.php//Submit File
SVN add filename//new file and add to SVN
SVN add *.php//(Add all PHP files in the current directory)
SVN delete test.php//delete test.php
SVN log test.php//view the log information of the test file
SVN cleanup//Clean up the current directory
################################### #设置svn自动更新, do not need to do a manual #####################
Automatic Updates
Join in the Vi/usr/local/svn/sunny/hooks/post-commit
#!/bin/sh
#设置一些变量
Svn=/usr/bin/svn
web=/the directory you want to update
Export Lang=en_us. UTF-8
$SVN Update $WEB--username SVN user name--password password
Where svn= to the right of the SVN command location generally defaults to/USR/BIN/SVN
web= right to your actual web directory
Give executable permission
chmod 777/usr/local/svn/sunny/hooks/post-commit
Installation Complete
=========================================================================
Other operations
SVN up update
SVN switch--relocate svn://192.168.1.253 svn://172.19.10.250//Relocate SVN repository address
SVN repository starting mode, now SVN has sunny, test two repository
1: Single-version library starter svnserve-d-r/usr/local/svn/sunny
2: Multi-version Library starter svnserve-d-R/USR/LOCAL/SVN
The difference is the start of the SVN command in the startup parameter-r specified directory.
To restrict different user permissions for different repository operations, modify the Authz file in the Conf directory in the Repository
To configure the sunny repository as an example
VI Authz
[Groups]
Teacher = Sunny,sunny1
[sunny:/]//Specify repository and directory permissions
@teacher = RW//teacher Group user rights are read and write
* = r//other users have read access only
Save exit
VI passwd set the user's account number and password in the group
[Users]
Sunny = 123456
Sunny1 = 123456
Installation of SVN on Linux