Build SVN service and svn

Source: Internet
Author: User
Tags install openssl tortoisesvn

Build SVN service and svn

Build SVN Service

I. SVN Introduction

SVN is short for Subversion and is an open-source version control system. The svn server runs in two ways: an independent server (for example, svn: // xxx.com/xxx) and apache (for example: http://svn.xxx.com/xxx) run. The two methods have their own advantages and disadvantages. You can choose one of them.

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 ). Because BDB may lock data when the server is interrupted, it is safer to use FSFS.

Ii. System Environment

1. The operating system is RHEL6.4 x86_64. To minimize installation, disable firewall and SLEINUX.

2. Software Download

Wget http://mirrors.hust.edu.cn/apache/subversion/subversion-1.9.2.tar.gz
Wget http://subversion.tigris.org/downloads/subversion-deps-1.6.9.tar.gz

Iii. Install SVN

1. Check whether the svn tool is installed.

# Rpm-qa | grep subversion

If the server has been installed, you do not need to install it. If not, you can perform a new installation. Here, you decide to perform a new installation and uninstall the system.

# Yum-y remove svn

2. First, check whether the system has installed SSL.

# Find/-name opensslv. h

If not, run the following command for installation:

# Yum-y 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 =

# Find/-name opensslv. h

/Usr/include/openssl/opensslv. h

3. Install the dependent package and decompress the svn Installation File

# Tar xf apr-1.5.1.tar.gz

# Cd apr-1.5.1

#./Configure -- prefix =/usr/local/apr

# Make

# Make install

② # Tar xf apr-util-1.5.4.tar.gz

# Cd apr-util-1.5.4

#./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr/

# Make

# Make install

# Tar xf subversion-deps-1.6.9.tar.gz

# Tar xf subversion-1.9.2.tar.gz

# Cd subversion-1.9.2

#./Configure -- prefix =/usr/local/svn -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util/

An error is reported, indicating that SQLite is to be installed. Therefore, install sqlite first.

# Tar xf sqlite-autoconf-3090100.tar.gz

# Cd sqlite-autoconf-3090100

#./Configure -- prefix =/usr/local/sqlite

# Make

# Make install

Continue to compile subversion

#. /Configure -- prefix =/usr/local/svn -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util/-- -sqlite =/usr/local/sqlite/

# Make

# Make install

4. Add svn-related commands to Environment Variables

# Echo "export PATH = $ PATH:/uar/local/svn/bin">/etc/profile

# Source/etc/profile

5. Test whether svn is successfully installed.

# Svnserve-version

4. Configure svn

1. Create the SVN root directory

# Mkdir/svn

2. Create a product warehouse

# Mkdir/svn/tshop

# Svnadmin create/svn/tshop/

If your R & D center has multiple product groups, each product group can create a SVN repository.

# Cd/svn/tshop/

# Mkdir item1

# Mkdir item2

3. Modify the version configuration Library File

# Vim/svn/tshop/conf/svnserve. conf

[General]

Anon-access = none # note that this parameter must be set. Otherwise, all users can access the service without a password.

Auth-access = write

Password-db = passwd

Authz-db = authz

Realm = tshop

Other configurations do not need to be modified. Keep the default value.

Changes to user configuration files take effect immediately without the need to restart svn

4. Start setting passwd User Account Information

# Vim/svn/tshop/conf/passwd

[Users]

Wdd = wdd

Jack = jack

Add the user and password below, each line of username = password

5. Set authz. User access permissions.

# Vim/svn/tshop/conf/authz

[Groups]

Devteam = wdd, jack

[/]

Wdd = rw

Jack =

[Tshop:/item1]

@ Devteam = rw

Jack =

[Tshop:/item2]

@ Devteam = rw

Jack = r

One user group can contain one or more users separated by commas.
Note:

Devteam = wdd, jack # The devteam project team includes two users: wdd and jack

[/]

Wdd = rw # wdd has read and write permissions on the root directory

Jack = # jack has no permissions on the root directory

# If you need to configure the permissions of item1 and item2, the prerequisite is that the tshop repository needs to have these two projects

# If not, tshop cannot be accessed.

[Tshop:/item1] # permission control for the item1 project of the tshop warehouse

@ Devteam = rw # control the devteam group to have read and write permissions on item1.

Jack = # restrict all permissions of jack. Other users have read and write permissions.

[Tshop:/item2] # permission control for the item2 project of the tshop Repository

@ Devteam = rw # Restrict the devteam group to read and write the item2 project.

Jack = r # Restrict jack to read only. Other users have read and write permissions.

6. 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:

1

2

3

4

5

6

7

[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/svn, and [/] indicates setting permissions for all version libraries.
[Tshop:/] indicates setting permissions for the tshop of the version library;
[Tshop:/abc] indicates setting permissions for the abc Project in the tshop;
[Tshop:/abc/aaa] indicates the permission to set the aaa directory of the abc Project in the tshop;
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.
7. Create a user to start svn

# Useradd svn # set a password for user svn as prompted

# Passwdd svn

# Chown-R svn: svn/# allow user svn to access the version Library

8. Start svn:

Method 1: svnserve-d-r/svn/# The default start port number is 3690.

Method 2: su-svn-c "svnserve-d-listen-port 9999-r/svn /"

Where:
Su-svn indicates to start svn as the user svn;
-D Indicates running in daemon mode (running in the background;

-Listen-port 9999 indicates port 9999, which can be replaced with the required port. Note that the root permission is required to use ports lower than 1024;
-R/opt/svn specifies that the root directory is/svn.

9. Check whether startup is enabled.

# Netstat-tunlp | grep svn

10. Add svn to startup

# Echo "/usr/local/svn/bin/svnserve-d-r/svn">/etc/rc. d/rc. local

11. To stop svn, run the following command:

Killall svnserve

12. If you want to use svn as a service:
Create a file named svn in the/etc/rc. d/init. d/directory.
Set the permission to 755: chmod 755/etc/rc. d/init. d/svn.
Edit the svn file vi/etc/rc. d/init. d/svn and add the following code:

#! /Bin/bash

# Build thisfile in/etc/rc. d/init. d/svn

SVN_HOME =/svn

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-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
Then you can start svn in the service SVN start (restart/stop) mode.
There are many ways to access svn through web. Refer to configuring websvn or bsSvnBrowser.

5. Client Access

1. Download the Installation File
Windows 32-bit words download: TortoiseSVN-1.9.2.26806-win32-svn-1.9.2.msi
Windows 64-bit words download: TortoiseSVN-1.9.2.26806-x64-svn-1.9.2.msi
2. access through the client
The address is as follows:
Svn: // {your-server-ip}: 9999/tshop/or svn: // {your-server-ip}: 3690/tshop/
Note:
Do not use http in your browser:
Http: // {your-server-ip}: 9999/tshop/or http: // {your-server-ip}: 3690/tshop/
This is definitely not feasible because http service is not configured, and an independent SVN server is installed on it.

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.