Build and configure the SVN Service

Source: Internet
Author: User

First, we will give a brief introduction to svn (subversion:

Running Mode

Independent server (e.g. svn: // xxx.com/xxx); with apache (e.g.: http://svn.xxx.com/xxx );

Data Storage

Svn also stores version data in two ways: BDB (a transaction-safe table type) and FSFS (a storage system that does not require a database ). BDB may lock data when the server is interrupted, so it is safer to use FSFS.

For more detailed introduction (working principle, etc.) Please click http://baike.baidu.com/view/183128.htm

I am using an independent server.,The procedure is as follows:

Environment:Centos5.6System

1.download subversion-1.6.21.tar.gzand subversion-deps-1.6.21.tar.gz. if the version is the same, otherwise an error will be reported during the installation process (The downloaded software is/Root/softDirectory)

[Root @ server ~] # Cd/root/soft
[Root @ serversoft] # ls
Using root@serversoft?#tarxfvzsubversion-1.6.21.tar.gz
Export root@serversoft?#tarxfvzsubversion-deps-1.6.21.tar.gz
[Root @ serversoft] # cdsubversion-1.6.21
[Root@serversubversion-1.6.21] #


2.CompileSvn

First, check whether the system has installed SSL:

[Root@serversubversion-1.6.21] # find/-nameopensslv. h
[Root@serversubversion-1.6.21] #
If not found, run the following command to install :(If the system prompts less dependent packages during installation,Just useYumInstall or download)

[Root@serversubversion-1.6.21] # yuminstallopenssl
[Root@serversubversion-1.6.21] # yuminstallopenssl-devel
After installation, run the find/-nameopensslv. h command to find the directory where opensslv. h is located, that is, the path following -- with-openssl =. Compile:
[Root@serversubversion-1.6.21] # find/-nameopensslv. h
/Usr/include/openssl/opensslv. h

/Root/soft/mysql-5.5.24/extra/yassl/include/openssl/opensslv. h
[Root@serversubversion-1.6.21] #./configure -- prefix =/usr/local/svn -- with-openssl =/usr/include/openssl -- without-berkeley-db
Note: Run in svnserve mode without adding apache compilation parameters. Store version libraries in fsfs format without compiling berkeley-db.
The following error is reported during compilation:
Configure: WARNING: unrecognizedoptions: -- with-openssl
Configure: ConfiguringSubversion1.6.6
Configure: creatingconfig. nice
Checkingforgcc... no
Checkingforcc... no
Checkingforcl.exe... no
Configure: error: in '/usr/local/src/subversion-100 ':
Configure: error: noacceptableCcompilerfoundin $ PATH
See 'config. log' formoredetails.
The gcc library is not installed. Run the following command to install gcc before compiling:
[Root@serversubversion-1.6.21] # yum-yinstallgcc
[Root@serversubversion-1.6.21] #./configure -- prefix =/usr/local/svn -- with-openssl =/usr/include/openssl -- without-berkeley-db
In the end, the following WARNING is displayed. Ignore it directly because the BDB storage is not used. Configure: WARNING: wehaveconfiguredwithoutBDBfilesystemsupport
Youdon 'tseemtohaveberkeleydbversion4. 0.14 ornewer
InstalledandlinkedtoAPR-UTIL.WehavecreatedMakefileswhich
WillbuildwithouttheBerkeleyDBback-end; yourrepositorieswill
UseFSFSasthedefaultback-end.Youcanfindthelatestversionof
BerkeleyDBhere:
Http://www.sleepycat.com/download/index.shtml


3.InstallSVN
To avoid the following errors
Errorwhileloadingsharedlibraries: libiconv. so.2: cannotopen#dobjectfile: Nosuchfileordirectory
First, perform the following operations:
1) edit the/etc/ld. so. conf file and add the following line:
/Usr/local/lib
2) Save and run ldconfig:
/Sbin/ldconfig

Note: ld. so. conf and ldconfig are used to maintain the dynamic link library of the system.
Install
[Root@serversubversion-1.6.21] # make & makeinstall

Run the following command to test the installation:

[Root@serversubversion-1.6.21] #/usr/local/svn/bin/svnserve -- version

Svnserve, version1.6.21 (r1462351)

CompiledJun92013, 14:25:58

Copyright (C) 2000-2009CollabNet.

Subversionisopensourcesoftware, seehttp: // subversion.apache.org/

ThisproductincludessoftwaredevelopedbyCollabNet (http://www.Collab.Net /).

Thefollowingrepositoryback-end (FS) modulesareavailable:

* Fs_fs: Moduleforworkingwithaplainfile (FSFS) repository.

To facilitate the following operations, add the svn bin to PATH, edit/etc/profile, and add:
PATH =/usr/local/svn/bin: $ PATH
Save and make it take effect immediately:
Source/etc/profile


4.ConfigurationSVN
Create a version library directory. You can create multiple directories:
[Root @ server ~] # Mkdir-p/home/svndata/test # create a version Library
[Root @ server ~] #/Usr/local/svn/bin/svnadmincreate/home/svndata/test # modify the version library configuration file
Edit/home/svndata/test/conf/svnserve. conf with the following content :(Note: The comments and spaces must be removed. Otherwise, an error will be reported if the connection fails to be identified)
[General]
Anon-access = none
Auth-access = write
Password-db =/usr/local/svn/conf/passwd. conf
Authz-db =/usr/local/svn/conf/authz. conf
Realm = test
Note: modifications to user configuration files take effect immediately without the need to restart svn.
Create the conf directory under/usr/local/svn/and create the passwd. conf and authz. conf files in/usr/local/svn/conf:
Mkdirconf
Cdconf/
Touchpasswd. conf
Touchauthz. conf

Add User and password:

[Root @ server ~] # Useradduser
[Root @ server ~] # Passwduser

Edit/usr/local/svn/conf/passwd. conf, add the following code and save

[Users]

User = pwd123! @#

Configure svn user access permissions, edit usr/local/svn/conf/authz. conf, add the following code, and save it:

[Groups]

Admin = user

[/] @ Admin = rw

[Test:/]

@ Admin = rw

Note:
* The user name displayed in the permission configuration file must be defined in the user configuration file.
* Changes to the permission configuration file take effect immediately without restarting svn.
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. We specify it as/home/svndata. [/] indicates setting permissions for all vertices.
[Repos:/] indicates that you have set permissions for version library repos;
[Repos:/abc] indicates setting permissions for the abc Project in the version library repos;
[Repos:/abc/aaa] indicates setting permissions for the aaa directory of the abc Project in the version library repos;
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.


5.StartSvn
Create a user to start svn:

[Root @ server ~] # Useraddsvn
[Root @ server ~] # Passwdsvn
Allow user svn to access the version Library:

[Root @ server ~] # Chown-Rsvn: svn/home/svndata
Start svn: [root @ server ~] # Su-svn-c "svnserve-d -- listen-port9999-r/home/svndata"
Where:
Su-svn: Start svn as the user svn;
-D: Indicates running in daemon mode (running in the background;
-- Listen-port9999: Indicates port 9999, which can be replaced with the port you need. Note that the root permission is required to use ports lower than 1024;
-R/home/svndata: Specify the root directory as/home/svndata.

Edit the/etc/rc. d/rc. local file and add the following startup command:/usr/local/svn/bin/svnserve-d -- listen-port9999-r/home/svndata
To stop svn, run the following command:
Killallsvnserve

Check whether startup is Enabled:

[Root @ server ~] # Ps-ef | grepsvn


6.ConnectionSVN
Install TortoiseSVN and restart the system.

Right-click the blank area in resource manager.SVNCheckout indicates that the installation is successful.

Start TortoiseSVN (right-click and selectSVNCheckout) and enter svn: // ip: 9999/test in the address bar.
Enter the user name and password as prompted.

If the following error occurs during connection:

Error: Authorizationfailed

It may bePasswd. confOrAuthz. confPermission issues caused by configuration files

If there are other connection errors,Please check/Home/svndata/test/confUnderSvnserve. confBefore modification in the file#Or whether the space is deleted


7. svnImport and export of client and server files

By default, a local storage directory (such as E:/test) is created when a client is connected)

[Root @ server ~] # Svnlistfile: // home/svndata/test // list the files in the version Library

[Root @ server ~] # Svncheckoutfile: // home/svndata/test // copy the files in the version Library to the local device.

By default, the test directory is created under the root of the server, which stores local files.

After a file is uploaded to the SVN version library, the uploaded file is no longer stored in the original file format, but is compressed into version library data by svn in its custom format, stored in the version Library (/home/svndata/test/db/revs ).

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.