Simple deployment and use of SVN
Originally published in cu:
Reference:
The svn server can run in two ways:
This document is based on independent server deployment and does not rely on apache.
There are two ways to store version data in svn:
The BDB mode may lock data when the server is interrupted. The FSFS mode is relatively secure. This document describes how to deploy the FSFS mode.
I. Environment
Server: CentOS-6.7-x86_64
Server IP: 172.18.11.212
Client: Win7 x86_64
2. software acquisition Server
Subversion Official Website: http://subversion.apache.org/
1.9.3 download: http://apache.fayea.com/subversion/subversion-1.9.3.tar.bz2
Client
TortoiseSVN Website: http://tortoisesvn.tigris.org/
1.9.3 x86_64 location download: http://netix.dl.sourceforge.net/project/tortoisesvn/1.9.3/Application/TortoiseSVN-1.9.3.27038-x64-svn-1.9.3.msi
Chinese Language Pack (the version must match; otherwise, the Language Pack will not take effect and cannot be found in the client settings ):
Http://pilotfiber.dl.sourceforge.net/project/tortoisesvn/1.9.3/Language%20Packs/LanguagePack_1.9.3.27038-x64-zh_CN.msi
Iii. Install svn 1. Prepare for system check
# Check whether svn has been installed on the server system # method 1 rpm-qa | grep subversion # method 2. Check whether the execution file ll/usr/bin/svn * # method 3 is available, if an execution file exists, view the version svnserve-version.
Dependent package General Compilation package
yum install autoconf libtool gcc gcc-c++ -y
Openssl (optional)
# Openssl is mainly used on the client through serf or on the apache server. # Detect find/-name opensslv. h # install yum or source code if not found (Omitted) yum install openssl-devel-y
After installation, find the directory where opensslv. h is located and use it when compiling svn."-- With-openssl ="Path.
Zlib (required)
# Zlib is mainly used as the binary difference algorithm of svn. The algorithm depends on zlib compression. # Check rpm qa | grep zlib * # if not found, install yum or the source code (http://zlib.net/, or get through the script behind the svnrelease) yum install zlib-devel-y
Used to compile svn"-- With-zlib ="With path (for non-default path source code installation ).
2. Install svn for decompression
Then place the downloaded subversion-1.9.3.tar.bz2 in the/usr/local/src directory, cd/usr/local/srctar-jxvf subversion-1.9.3.tar.bz2cd subversion-1.9.3
Supporting dependency packages
# There is an executable script get-deps.sh In the subversion-1.9.3 directory, you can download version-related dependency packages; # after the execution of the subversion-1.9.3 folder out of the apr, apr-util, zlib, serf (related to client access to svn through apache service), sqlite-amalgamation, and other folders. apr, apr-util, and zlib are mandatory dependent packages for subversion, which may have been installed in the system, however, the version may not match (especially apr and apr-util, so the dependency package downloaded using this script is the best ).. Get-deps.sh
Apr/apr-util
cd apr./configure --prefix=/usr/local/aprmakemake installcd ../apr-util./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmakemake install
Compile and install
# If you do not use the bdb method, a warning cd may be triggered during pre-compilation... /configure -- prefix =/usr/local/svn -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util --- berkeley-dbmakemake install
Environment Variable
# Add the svn command directory to the environment variable vim/etc/profile export PATH =/usr/local/svn/bin: $ PATHsource/etc/profile # or add svn commands to environment variables using soft links, ln-s/usr/local/svn/bin/*/usr/bin/
Verify
# Svnserve -- version is successful when version information is returned
3. Deploy svn to create a version Library
# Create the root directory of the Repository mkdir-p/svn # create the version library svntest. If you have multiple projects, you can create multiple version libraries mkdir-p/svn/svntestsvnadmin create/svn/svntest
Version configuration Library File
# Configuration file directory cd/svn/svntest/conf/vim svnserve of the version library svntest. conf # cancel the comments of the following lines under the general project. Note: each line must start with a header and cannot contain spaces, otherwise, an error is reported. For lines 27/36/47, you can use the relative path (passwd/authz is the file in the conf file of the version library by default, and svntest is the svntest root directory of the version library ), you can also specify the absolute path 19 anon-access = none # required, otherwise, all users can access 20 auth-access = write27 password-db = passwd36 authz-db = authz47 realm = svntest without a password.
User Configuration File
Cd/svn/svntest/conf/vim passwd [users] # harry = harryssecret # sally = sallyssecret # Set Logon account and password # changes to user configuration files take effect immediately, no need to restart the service testuser = testsecret
Permission configuration file
# Except for the following modifications, the default configuration can remain unchanged: cd/svn/svntest/conf/vim authz # Set the admin group. The user testuser is added to the admin group. One user group can contain multiple users, use commas to isolate [groups] admin = testuser # Set the admin group to have the read and write permissions for the svntest root directory and the following. You can also set the permission for a single user, such as testuser = rw [svntest: /] @ admin = rw # the account in the permission configuration file must be defined in the user configuration file. Modifications to the permission configuration file take effect immediately without restarting the svn service.
Authz File Syntax user group format
[Groups]
=,
One user group can contain one or more users separated by commas.
Version library directory format
[<Version library>:/project/directory]
@ <User group name >=< permission>
<User name >=< permission>
The box number can be written in multiple ways:
[/] Indicates the root directory and the following. The root directory is specified when svnserve is started. [/] indicates that the root directory of the repository has the setting permission;
[Version Library:/] indicates setting permissions for version library xxx, such as the svntest version library specified above;
[Version Library:/project] indicates setting permissions for a project in version library xxx;
[Version Library:/project/directory] indicates setting permissions for a directory of a project in version library xxx;
The permission subject can be a user group, user, or *. The user group is preceded by @, * indicating all users;
The permission can be w, r, wr, or null. If it is null, no permission is granted.
Start svn
#-D Indicates running in daemon mode; # -- listen-port indicates the monitoring port. If this parameter is not specified, port 3690 is used by default. Multiple svn libraries can be enabled through the port; #-r specifies the repository root directory,Note that the database root directory is not a specific version., The root directory settings are associated with the client logon address. If the settings are inappropriate, many logon problems may occur. svnserve-d -- listen-port 5690-r/svn/# verify ps aux | grep svn # Stop svnkillall svnserve
Start svn
# Note: Modify shell settings, such as SVN_HOME and port # Do not delete # chkconfig:-85 15 and # description: svn server; otherwise, chkconfig cannot be used to join the service, the system prompts service svn does not support chkconfigvim/etc/rc. d/init. d/svn #! /Bin/bash # chkconfig:-85 15 # description: svn serverSVN_HOME =/svnif [! -F "/usr/local/svn/bin/svnserve"] thenecho "svnserver startup: cannot start" exitficase "$1" instart) echo "Starting svnserve... "/Usr/local/svn/bin/svnserve-d -- listen-port 5690-r $ SVN_HOMEecho" Finished! "; Stop) echo" Stoping svnserve... "Killall svnserveecho" Finished! "; Restart) $0 stop $0 start; *) echo" Usage: svn {start | stop | restart} "exit 1 esac # grant the startup script permission chmod 755/etc/rc. d/init. d/svnchkconfig -- add svnchkconfig -- level 35 svn on # can also be easily processed, such as editing rc. local file vim/etc/rc. d/rc. local/usr/local/svn/bin/svnserve-d-listen-port 5690-r/svn
Iptables
# Open the corresponding port and save iptables to set iptables-a input-m state -- state NEW-m tcp-p tcp -- dport 5690-j ACCEPT/etc/rc. d/init. d/iptables save
4. Client TortoiseSVN
Install the TortoiseSVN client and Language Pack. The access path is svn: // ip: port.
The following is a simple tutorial.
Data Import
Select the local file directory to be imported to the server, right-click and choose TortoiseSVN to import the file, as shown below:
Enter the version library address,
Enter the user name/password for the first use,
Data Detection
Right-click the directory to be checked out, and select SVN check-> Export
Enter the URL of the exported version Library and the directory to be exported,
Update and submit
If the version is updated, right-click the appropriate directory and choose --> SVN update;
If the local file is changed, you need to upload it to the server, select the appropriate directory, right-click --> SVN submit.
We recommend that you update SVN to the latest version on the server, modify the latest version locally, and then submit the update.
Add file/directory
If a file/directory is added to the check-out directory,You need to add it first, and then submit SVN to the version library., As follows,
If the added file symbol is changed as follows, SVN can only be submitted to the version library.
Delete files/Directories
If you want to delete files/directories on the server, you cannot delete them locally,Right-click the deleted file/directory --> TortoiseSVN --> Delete, return to the parent directory, and submit the file in SVN..