CentOS Configure SVN server with Yum installation steps

Source: Internet
Author: User
Tags auth mkdir svn perl script

Simple, with Yum installation method:

#yum Install Subversion

After the installation is complete, use the following to see if the installation is complete

#svn--version

Create SVN warehouses, such as:

#mkdir-P/DATA/SVN
#svnadmin Create Opengeo

You will then find that you automatically generate files or directories such as CONF, DB, format, hooks, locks, README.txt, and so on.

Modify the configuration file in the Conf directory

In svnserve.conf, the edit configuration is:

[General]
Anon-access = None
auth-access = Write
Password-db = passwd
Authz-db = Authz

In Auth, the configuration group and permissions are:

[Groups]
dev = User1,user2,user3
[/]
@dev = RW

The user name and password are configured in passwd as follows:

[Users]
User1=pass1
User2=pass2
User3=pass3

After a few steps, Setup and configuration complete, start SVN and specify the appropriate directory:

#svnserve-D-r/data/svn/

To see if the service started successfully

#netstat-NLP | grep SVN

Turn off the SVN service

#killall-9 Svnserve

Then, you can access it via the following address, {IP} replaced with your SVN server IP address or domain name:

Svn://{ip}/opengeo

SVN Server Detail Configuration manual


System environment
CentOS 5.8 Minimize installation (Turn off iptables and SELinux) + ssh + Yum

First, install the necessary packages.
Yum Install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced

Description
Subversion (SVN server)
Mysql-server (for Codestriker)
httpd mod_dav_svn Mod_perl (used to support web-style management of SVN servers)
SendMail (for configuring user to submit code and email reminders)
wget gcc-c++ make unzip perl* (prerequisite package)
NTSYSV vim-enhanced (optional)

Two, basic SVN server configuration
1, create a new directory to store all SVN files
# MKDIR/HOME/SVN

2, create a new version of the warehouse
# svnadmin Create/home/svn/project

3, initializing the directory in the version warehouse
# mkdir Project Project/server project/client project/test (Create temp directory)
# SVN import project/file:///home/svn/project-m "Initialize SVN catalog"
# RM-RF Project (delete the temporarily established directory)

4, add user
Adding an SVN user is very simple, just add a "Username=password" entry to the/home/svn/project/conf/passwd file. To test, I added the following:

[Users]
# Harry = Harryssecret
# sally = Sallyssecret
PM = PM_PW
Server_group = SERVER_PW
Client_group = CLIENT_PW
Test_group = TEST_PW

5, modify user access Policy
/home/svn/project/conf/authz records the user's access policy, the following are references:

[Groups]
project_p = PM
project_s = Server1,server2,server3
Project_c = Client1,client2,client3
project_t = Test1,test1,test1


[project:/]
@project_p = RW
* =

[Project:/server]
@project_p = RW
@project_s = RW
* =

[Project:/client]
@project_p = RW
@project_c = RW
* =

[Project:/doc]
@project_p = RW
@project_s = R
@project_c = R
@project_t = R
* =

Note: The above information indicates that only the Project_p user group has the right to read and write the root directory. R indicates that there is read access to the directory, W indicates that there is write access to the directory, and RW indicates that there is read and write access to the directory. The last line of * = indicates that no one else is allowed to access this directory except for the user group with the permissions set above. This is very important and must be added!

6, modify the svnserve.conf file, so that users and policy configuration to increase efficiency.
Svnserve.conf contents are as follows:

[General]
Anon-access = None
auth-access = Write
Password-db =/home/svn/project/conf/passwd
Authz-db =/home/svn/project/conf/authz

7, start the server
# svnserve-d-R/HOME/SVN
Note: If you modify the SVN configuration, you need to restart the SVN service as follows:

# Ps-aux|grep Svnserve
# kill-9 ID Number
# svnserve-d-R/HOME/SVN

8, test server

# SVN Co svn://192.168.60.10/project
Authentication Realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for ' root ':
Authentication Realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Username:server_group
Password for ' Server_group ':
Svn:authorization failed (Server_group access to the root directory)

# SVN Co svn://192.168.60.10/project
Authentication Realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for ' root ':
Authentication Realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
username:pm
Password for ' PM ':
A Project/test
A Project/server
A project/client
Checked out Revision 1. (Test extraction succeeded)

# CD Project/server
# Vim MAIN.C
# SVN Add main.c
# SVN commit main.c-m "Test my C program, see What to see, no ah??"
Adding MAIN.C
Transmitting file data.
Committed revision 2. (Test submission succeeded)

Configuring HTTP support for SVN servers
1, convert the SVN server password
Since the password for the SVN server is plaintext, the HTTP server is not supported and needs to be converted to the HTTP-supported format. I wrote a perl script to do the job.
The script reads as follows:
# cd/home/svn/project/conf/
# Vim ptowp.pl

#!/usr/bin/perl # Write by Huabo, 2009-11-20 use warnings;  Use strict; #open The SVN passwd file open (file, "passwd") or Die ("Cannot open the passwd file!!!  n "); #clear the Apache passwd file open (out_file, ">webpasswd") or Die ("Cannot open the WEBPASSWD file!!! n ");  Close (Out_file); #begin foreach (<FILE>) {if ($_ =~ m/^[^#].*=/) {$_ =~ s/=//; ' Htpasswd-b webpasswd $_ ';}} # chmod +x ptowp.pl
#./ptowp.pl
Adding password for user pm
Adding password for user Server_group
Adding password for user Client_group
Adding password for user Test_group
Now there will be one more webpasswd file in the directory.

2, modify httpd.conf, add content about the SVN server
Edit the/etc/httpd/conf/httpd.conf and add the following information at the end:

<Location/project>
DAV SVN
svnpath/home/svn/project/
AuthType Basic
AuthName "SVN for Project"
authuserfile/home/svn/project/conf/webpasswd
Authzsvnaccessfile/home/svn/project/conf/authz
Satisfy All
Require Valid-user
</Location>


3, modify the owner of the SVN directory for Apache account: Chown-r apache.apache/home/svn/project/
(Note: The original text is less this step, will issue permissions.) )
4, restart the Web server:
#/etc/init.d/httpd Restart
stopping httpd: [FAILED]
Starting httpd: [OK]

5, access the http://192.168.60.10/project/server/test with the browser

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.