Configure SVN + SVN hooks in CentOS Linux

Source: Internet
Author: User

Configure SVN + SVN hooks in CentOS Linux

Environment Introduction:
Operating System: CentOS release 6.5 (Final) 64-bit
Network Environment: Intranet

1. Configure SVN
1.1 install the SVN package
Use yum to install the components required by svn
# Yum-y install subversion

1.2 configure SVN
1.2.1 create svn LIBRARY PATH
Create the svn library path, which later provides user file writing and reading.
# Mkdir-p/date/svn/

1.2.2 create SVN version Library
Use a specific command to create a version library. After successful creation, the SVN configuration file will appear in the directory.
# Svnadmin create/date/svn/

1.2.3 define the configuration file
# Vim/opt/svndata/repos1/conf/svnserve. conf

[General]
Anon-access = none
Auth-access = write
Password-db = passwd # configuration file that defines the User password
Authz-db = authz # configuration file that defines User Permissions
Realm = svn

1.2.4 user permission Configuration
1. Create svn Access Users
# Vim/data/svn/passwd

[Users]
Test = test creates a user named "tset password" test ".

2. Configure user access permissions
# Vi/opt/svndata/repos1/conf/authz

[Groups]
Admin = test
# Harry_and_sally = harry, sally
[/]
@ Admin = rw
[Repos1:/abc/aaa]
@ Admin = r

Version library directory format:
[<Version library>:/project/directory] # takes the project name as the first unit. Imagine a project as a unit.
@ <User group name >=< permission>
<User name >=< permission>
The box number can be written in multiple ways:
/, Indicating the root directory and the following. The root directory is specified when svnserve is started. We specify it as/opt/svndata. In this way,/sets permissions for all version libraries.
Repos1:/, indicating to set permissions for Version 1
Repos2:/abc, indicating to set permissions for the abc Project in version library 2
Repos2:/abc/aaa, indicating to set permissions for the aaa directory of the abc Project in version library 2
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.
1.2.5 start SVN
# Svnserve-d-r/date/svn/

-D Indicates running in daemon mode (running in the background)
-R/date/svn specifies that the root directory is/date/svn
1.3 configure hooks
1.3.1 configure a version check tool
I used python to write a tool that automatically detects the file version in the library. The Code is as follows:
# Vim/date/svn/hooks/gouzi. py
#! /Usr/bin/env python
If _ name __= = '_ main __':
Importsys, string
Try:
Logfile = open ('/tmp/python. out', 'a + ')
Logfile. write ("this is python hook ")
Logfile. close ()
Except t:
Exit (1)
Sys. exit (0)

This tool must be stored in the hooks directory in the library directory.
1.3.2 configure the UPDATE script
1. Manually checkout once on the client
# Svn checkout svn: // 192.168.21.28/repos

2. Edit the automatic synchronization script
# Vim svn_update.sh

The Code is as follows:
#! /Bin/bash
/Usr/bin/svn update/linshi/repos -- username test -- password test
If [$? = 0]
Then
Echo "OK">/tmp/z. out
Fi

Where:/linshi/is the storage directory (depending on the environment)
-- Username test username is test
-- Password test: password test
3. Modify permissions
# Chmod + x/root/svn_update.sh

4. Configure scheduled tasks
Because the script cannot be automatically executed, configure the scheduled task to be executed once per minute.
# Crontab-e
* ***/Root/svn_update.sh>/dev/null 2> & 1

Set up SVN server svn in Ubuntu 14.04 ://

CentOS 6.2 SVN setup (YUM installation)

Deploy Apache + SVN in CentOS 6.5

Build an SVN server using Apache + SVN

Set up and use the SVN server in Windows + reset the password on the client

Install SVN in Ubuntu Server 12.04 and migrate Virtual SVN data

Build svn service and migration method on Ubuntu Server

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.