Linux Build SVN server

Source: Internet
Author: User
Tags version control system tortoisesvn collabnet

Linux Build SVN server

I. Introduction to SVN

Subversion (SVN) is an open source version control system, which means that subversion manages data that changes over time. This data is placed in a central data archive (repository). This archive is much like an ordinary file server, but it remembers every change in the file. You can then restore the file to the old version, or browse the history of the document.

Some of the concepts in SVN:

(1). Repository (source code library)

Where source code is stored uniformly

(2). Checkout (extract)

When you have no source code on your hands, you need to checkout a copy from Repository.

(3). Commit (Submit)

When you've changed the code, you'll need to commit to repository.

(4). Update (Updated)

When you have checkout a source code, update you can be synchronized with the source code on the repository, you will have the latest changes

The daily development process is actually like this (assuming you've been checkout and working for a few days): Update (Get the latest code)--Make your own changes and debug success--Commit (you can see your changes).

If two programmers modify the same file at the same time, SVN can merge the two programmer's changes, in fact, the SVN management source code is in the behavior unit, that is, two programmers as long as not modify the same line program, SVN will automatically merge two changes. If the same line, SVN will prompt the file confict, conflict, need to manually confirm.

Client software:

(1) Commonly used client software under Windows TORTOISESVN. It is a free open source client. : http://tortoisesvn.net/downloads.html

(2) to MyEclipse, there are some SVN plugins.

Subversion provides the following key features:

(1) Catalog version control

CVS can only track the history of a single file, but Subversion has a "virtual" version of the control file system that can track changes in the entire directory depending on time. Both directories and files can be version controlled.

(2) True version history

Since CVS has restricted the file's version history, CVS does not support actions that might occur on the file but affect the contents of the directory, like copying and renaming. In addition, in CVS you cannot replace a file that has been included in the system with files that have the same name but do not inherit the old version history or have no relationship at all. In subversion, you can add (add), delete, copy (copy), and rename (rename), whether it's a file or a directory. All the newly added files start with a new, clean version.

(3) Automatic submission

A commit action, not all updates to the archive, is completely not updated. This allows developers to create and commit changes in logical intervals to prevent problems that occur when a partial commit succeeds.

(4) Meta-data included in version control

Each file and directory is accompanied by a group of attribute keywords and associated with the attribute value. You can create and save any key/value you want. Properties are versioned over time, just like file content.

(5) Select a different network layer

Subversion has an abstract repository access concept that makes it easy for people to implement new network mechanisms. Subversion can be embedded as an extension module in the Apache HTTP server. This provides the most advanced stability and collaboration capabilities for subversion, and in addition provides many important features: For example, authentication, authorization, online compression, and file vault browsing. There is also a lightweight standalone subversion server that uses a custom communication protocol that can be easily used by SSH in tunnel mode.

(6) Consistent method of data processing

Subversion uses binary difference algorithms to differentiate between file differences, and it treats both types of text (human understandable) and binary files (which humans cannot understand) equally. Both types of files are stored in the archive in the same compressed form, and the file differences are transmitted over the network in two directions.

(7) Valid Branch (branch) and tag (tag)

The consumption on the branch and label does not have to be proportional to the size of the project. Subversion creates branching and tagging methods, just copying the project, using a method similar to hard join (Hard-link). So these operations only take a small amount of time and are fixed.

(8) Hackability

Subversion does not have any historical baggage; It is mainly a group of common C libraries, with well-defined APIs. This makes Subversion easy to maintain and can be used by other applications and program languages.

Two. SVN Server Setup

2.1 Installing SVN packages with Yum

Configuration reference for the Yum server:

Linux Build YUM Server

Http://blog.csdn.net/tianlesoftware/archive/2011/01/03/6113902.aspx

[email protected] ~]# Yum install-y Subversion

Loaded Plugins:rhnplugin, security

This system isn't registered with the portal.

Portal support would be disabled.

Setting up Install Process

Resolving Dependencies

--Running Transaction check

---> Package subversion.i386 0:1.4.2-4.el5_3.1 Set updated

--Finished Dependency Resolution

Dependencies resolved

====================================================================================================

Package Arch Version Repository Size

====================================================================================================

Installing:

Subversion i386 1.4.2-4.el5_3.1 rhel-base 2.3 M

Transaction Summary

====================================================================================================

Install 1 package (s)

Update 0 Package (s)

Remove 0 Package (s)

Total Download size:2.3 M

Downloading Packages:

subversion-1.4.2-4.el5_3.1.i386.rpm | 2.3 MB 00:00

Running Rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing:subversion 1/1

Installed:

Subversion.i386 0:1.4.2-4.el5_3.1

complete!

[Email protected] ~]#

To verify the installation version:

[Email protected] ~]# Svnserve--version

Svnserve, version 1.4.2 (r22196)

Compiled 5 2009, 19:03:56

Copyright (C) 2000-2006 CollabNet.

Subversion is open source software, see http://subversion.tigris.org/

This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository back-end (FS) modules is available:

* Fs_base:module for working with a Berkeley DB repository.

* Fs_fs:module for working with a plain file (FSFS) repository.

2.2 Creating the SVN repository

[Email protected] ~]# MKDIR/U02/SVN

[[email protected] ~]# svnadmin create/u02/svn/davesvn--davesvn as repository name

2.3 SVN Configuration

Once the repository is created, 3 configuration files are generated in this directory:

[Email protected] conf]# pwd

/u02/svn/davesvn/conf

[[email protected] conf]# ls

Authz passwd svnserve.conf

(1) Under the SVNSERVE.CONF:SVN service configuration file.

(2) passwd: User name password file.

(3) Authz: Privilege profile.

svnserve.conf file, the file configuration entry is divided into the following 5 items:

Anon-access: Controls the permissions of non-authenticated users to access the repository.

Auth-access: Controls the permissions of the authentication user to access the repository.

PASSWORD-DB: Specifies the user name password file name.

AUTHZ-DB: Specifies the permission profile file name through which path-based access control can be implemented.

Realm: Specifies the authentication domain for the repository, which is the name of the authentication domain that is prompted at logon. If the authentication domain of the two repositories is the same, it is recommended to use the same username password data file

PASSWD file:

We enable this file in the svnserve.conf file. Then configure the following:

[email protected] conf]# cat passwd

# # # This file is a example password file for Svnserve.

# # # Its format was similar to that of svnserve.conf. As shown in the

# # # example below it contains one section labelled [Users].

# # # The name and password for each user follow, one account per line.

[Users]

# Harry = Harryssecret

# sally = Sallyssecret

Dave = Davepwd

Tianlesoftware = Tianlesoftwarepwd

Authz file:

Find a good example of configuration on the Web:

[Groups]

admin = John, Kate

DEVTEAM1 = John, Rachel, Sally

Devteam2 = Kate, Peter, Mark

Docs = Bob, Jane, Mike

Training = Zak

--here to put different users into different groups, the following in the setting Directory access permissions, the directory to operate on it.

# Specify default access rules for all libraries

# Everyone can read, admin can write, dangerous molecule without any permission

[/]--corresponding to my test:/U02/SVN directory

* = R

@admin = RW

Dangerman =

# allows developers to have full access to their project repository

[proj1:/]

@devteam1 = RW

[proj2:/]

@devteam2 = RW

[bigproj:/]

@devteam1 = RW

@devteam2 = RW

Trevor = RW

# document writers have write access to all docs directories

[/trunk/doc]

@docs = RW

# trainers have full access to the training repository

[trainingrepos:/]

@training = RW

Let's configure our Authz file:

[email protected] conf]# cat Authz

[Groups]

admin = Dave

Dev=tianlesoftware

[davesvn:/]

@admin = RW

@dev = RW

[Email protected] conf]#

2.4 Starting and stopping SVN services

(1) Start the SVN service:

[Email protected] conf]# svnserve-d-R/U02/SVN

-D indicates background run

-r specifies that the root directory is/U02/SVN

[Email protected] conf]# Ps-ef | grep SVN

Root 4592 1 0 18:04? 00:00:00 svnserve-d-R/U02/SVN

Root 4594 3709 0 18:04 pts/1 00:00:00 grep svn

(2) To stop the SVN service:

Ps-aux |grep SVN

Kill-9 process Kill

Three. Client connection to SVN server

3.1 Installing the TORTOISESVN client

Described in the first section.

3.2 Find your project's directory, right-click, do SVN operation

(1) New test directory SVN, right after entering, point checkout:

The IP address and repository name of the SVN server.

Create a new file svn.txt. Upload this file to the SVN server (add):

 

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.