Full explanation of how to build and deploy an independent SVN server under CentOS5.5

Source: Internet
Author: User
Tags tortoisesvn collabnet
SVN server has two ways to run: 1, independent server (for example: svn: // xxx.com/xxx); 2, with apache (for example: http://svn.xxx.com/xxx); in order not to rely on apache, I chose the first method: Independent svn server. The SVN storage version data can also be stored in two ways: 1. B... the SVN server can run in two ways:
1. independent server (for example, svn: // xxx.com/xxx );
2. using apache (for example: http://svn.xxx.com/xxx );
In order not to rely on apache, I chose the first method: Independent svn server.
There are two ways to store version data in SVN:
1. bdb;
2. fsfs.
Because the bdb method may lock data when the server is interrupted, it is safer to use the fsfs method. I also choose this method.
Specific deployment:
1. download the subversion installation package [root @ server ~] # Cd/usr/local/src
[Root @ server src] # ls
[Root @ server src] # wget http://subversion.tigris.org/downloads/subversion-1.6.6.tar.gz
[Root @ server src] # wget http://subversion.tigris.org/downloads/subversion-deps-1.6.6.tar.gz
[Root @ server src] # tar xfvz subversion-1.6.6.tar.gz
[Root @ server src] # tar xfvz subversion-deps-1.6.6.tar.gz
[Root @ server src] # cd subversion-1.6.6
[Root @ server subversion-1.6.6] #
 
2. compile SVN
First, check whether the system has installed SSL: [root @ server subversion-1.6.6] # find/-name opensslv. h
[Root @ server subversion-1.6.6] #
If it cannot be found, run the following command to install: [root @ server subversion-1.6.6] # yum install openssl
[Root @ server subversion-1.6.6] # yum install openssl-devel
After installation, run the find/-name opensslv. h command to find the directory where opensslv. h is located, that is, the path following -- with-openssl =. Compile:
[Root @ server subversion-1.6.6] # find/-name opensslv. h
/Usr/include/openssl/opensslv. h
[Root @ server subversion-1.6.6] #./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: unrecognized options: -- with-openssl
Configure: refreshing ing Subversion 1.6.6
Configure: creating config. nice
Checking for gcc... no
Checking for cc... no
Checking for cl.exe... no
Configure: error: in '/usr/local/src/subversion-100 ':
Configure: error: no acceptable C compiler found in $ PATH
See 'config. log' for more details.
The gcc library is not installed. run the following command to install gcc before compiling:
[Root @ server subversion-1.6.6] # yum-y install gcc
[Root @ server subversion-1.6.6] #./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: we have configured without BDB filesystem support
You don't seem to have Berkeley DB version 4.0.14 or newer
Installed and linked to APR-UTIL. We have created Makefiles which
Will build without the Berkeley DB back-end; your repositories will
Use FSFS as the default back-end. You can find the latest version
Berkeley DB here:
Http://www.sleepycat.com/download/index.shtml
3. install SVN
To avoid the following errors
Error while loading shared libraries: libiconv. so.2: cannot open shared object file: No such file or directory
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 @ server subversion-1.6.6] # make & make install
 
 
After the installation is complete, run the following command to test:
[Root @ server subversion-1.6.6] #/usr/local/svn/bin/svnserve -- version
 
Svnserve, Version 1.6.6 (r40053)
Compiled on Feb 15
 
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/site.
This product contains software developed by CollabNet (http://www.Collab.Net.
 
The backend (FS) module of the library is available in the following versions:
 
* Fs_fs: This module works with the text file (FSFS) version Library.
 
 
 
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. configure SVN
Create a version Library Directory. you can create multiple directories:
[Root @ server ~] # Mkdir-p/home/svndata/repos # Create a version Library
[Root @ server ~] #/Usr/local/svn/bin/svnadmin create/home/svndata/repos # Modify the version Library configuration file
 
Edit/home/svndata/repos/conf/svnserve. conf with the following content:
[General]
Anon-access = none
Auth-access = write
Password-db =/usr/local/svn/conf/passwd. conf
Authz-db =/usr/local/svn/conf/authz. conf
Realm = repos
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:
Mkdir conf
Cd conf/
Touch passwd. conf
Touch authz. conf
 
Add user and Password: [root @ server ~] # Useradd wll
[Root @ server ~] # Passwd wll
 
Edit/usr/local/svn/conf/passwd. conf, add the following code and save it:
[Users]
Wll = 123456
Configure svn user access permissions, edit usr/local/svn/conf/authz. conf, add the following code, and save it:
[Groups]
Admin = wll
[/]
@ Admin = rw
# [Repos:/abc/aaa]
# King = rw
# [Repos:/pass]
# King = svn
 
 
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:
[ <版本库> :/Project/directory]
@ <用户组名> = <权限>
<用户名> = <权限>
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.
 
Create a user to start svn: [root @ server ~] # Useradd svn
[Root @ server ~] # Passwd svn
Allow user svn to access the version Library: [root @ server ~] # Chown-R svn: svn/home/svndata
Start svn: [root @ server ~] # Su-svn-c "svnserve-d -- listen-port 9999-r/home/svndata"
 
Where:
Su-svn: start svn as the user svn;
-D: indicates running in daemon mode (running in the background;
-- Listen-port 9999: port 9999, which can be changed to 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.
 
5. add svn to startup
Edit/etc/rc. d/rc. add the following startup command to the local file:/usr/local/svn/bin/svnserve-d -- listen-port 9999-r/home/svndata
To stop svn, run the following command:
Killall svnserve
To use svn as a service, create a file named svn in the/etc/rc. d/init. d/directory, set the permission to 755, and add the following code :#! /Bin/bash
# Build this file in/etc/rc. d/init. d/svn
# Chmod 755/etc/rc. d/init. d/svn
# Run the following command in centos to manage svn: service svn start (restart/stop)
SVN_HOME =/home/svndata
If [! -F "/usr/local/svn/bin/svnserve"]
Then
Echo "svnserver startup: cannot start"
Exit
Fi
Case "$1" in
Start)
Echo "Starting svnserve ..."
/Usr/local/svn/bin/svnserve-d -- listen-port 9999-r $ SVN_HOME
Echo "Finished! "
;;
Stop)
Echo "Stoping svnserve ..."
Killall svnserve
Echo "Finished! "
;;
Restart)
$0 stop
$0 start
;;
*)
Echo "Usage: svn {start | stop | restart }"
Exit 1
Esac
6. connect to SVN
Install TortoiseSVN and restart the system. Start TortoiseSVN and enter svn: // 192.168.1.87: 9999/repos in the address bar
 
Enter the user name and password as prompted.
 
 
 
 
 
This article is from the "second dwelling" blog
Related Article

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.