Install svn under centos6.5

Source: Internet
Author: User
Tags perl script

Install svn under centos6.5

I have been building svn over the past few days. I have searched a lot of information online, and none of them are complete. So I have compiled a installation manual and recorded it, the first is to take a note for yourself, and the second is to give you a reference.

The following is a simple directory description:

Subversion directory description:
* Dav Directory: Provides the directories used by apache and mod_dav_svn to store internal data.
* Db Directory: stores all version-controlled data files.
* Hooks Directory: directory for storing hook script files
* Locks Directory: used to place the subversion. See the directory for hard-locking data. It is used to track the client that accesses the file library.
* Format File: a text file with only one integer. Indicates the version number of the current file library configuration.
* Conf directory: it is the configuration file of this warehouse (the Warehouse's user access account, permissions, etc)

System Environment
CentOS 6.5 desktop installation form (disable iptables and selinux)

1. install required software packages.
yum install subversionmysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced

Note:
Subversion (SVN server)
Mysql-server (for codestriker)
Httpd mod_dav_svn mod_perl (used to manage SVN servers on the WEB)
Sendmail (used to configure the user to send an email notification after the code is submitted)
Wget gcc-c ++ make unzip perl * (Required Software Package)
Ntsysv vim-enhanced (optional)

Ii. Basic SVN Server Configuration
1. Create a directory to store all SVN files.
# Mkdir/home/svn

2. Create a version Repository
# Svnadmin create/home/svn/project

3. initialize the directory in the version repository.
# Mkdir project/server project/client project/test (create a temporary directory)
# Svn import project/file: // home/svn/project-m "initialize SVN directory"
# Rm-rf project (delete temporary directories)

4. Add a user
To add SVN users, you only need to add an entry in the format of "username = password" to the/home/svn/project/conf/passwd file. For testing, I added the following content:

[Users]

# Harry = harryssecret

# Sally = sallyssecret

Admin= 123456

Huangyunping = 123456

Hekaining = 123456

Shunfeng = 123456

Zhushengnan = 123456

Gaozhe= 123456

Luwenjun = 123456

Fangwei= 123456

Yefuhua= 123456

Wangwei= 123456

Chenwei = 123456

Explanation: The above is to create a user account. No matter which group the above account is, the user account must be created in this place as long as there is a login. The group is in
Under the authz file. In the admin account above, I create an account with the highest permissions. Name = Password

5. Modify the User Access Policy
/Home/svn/project/conf/authz records the user's access policy. I have struggled for a few days, because the access directories are different, but you will understand it after trying it out. There are a lot of # comments out of the code, you can not read it, I am posting useful scripts here. The following is a reference:

[Aliases]

# Joe =/C = XZ/ST = Dessert/L = Snake City/O = Snake Oil, Ltd./OU = Research Institute/CN = Joe Average

# Group Access Permissions

[Groups]

Project_admin = admin, wangwei

Project_ui = huangyunping

Project_app = hekaining

Project_web = shunfeng, zhushengnan

Project_jg = liuyuntao

Project_yj = gaozhe, luwenjun

Project_test = fangwei, yefuhua

Project_products = chenwei

# Access paths of each group

[Project:/]

@ Project_admin = rw

* =

[Project:/ui]

@ Project_ui = rw

@ Project_admin = rw

* =

[Project:/app]

@ Project_app = rw

@ Project_admin = rw

* =

[Project:/web]

@ Project_web = rw

@ Project_admin = rw

* =

[Project:/jiagou]

@ Project_jg = rw

@ Project_admin = rw

* =

[Project:/yingjian]

@ Project_yj = rw

@ Project_admin = rw

* =

[Project:/test]

@ Project_test = rw

@ Project_admin = rw

* =

[Project:/products]

@ Project_products = rw

@ Project_admin = rw

* =


Note:

Create a group name = Member, which is the account created in passwd. There are two parts: the upper part is the group, and the lower part is the access path of the group.

[Project name,/folder that restricts access to this Group]

Rw is the read/write permission, and r is the read-only permission. * = Of the last row of each group indicates that no one except the user group with the preceding permissions is allowed to access this directory. This is very important and must be added!

6. Modify the svnserve. conf file to make the user and policy configuration more effective.
The content of svnserve. conf is 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 the svn configuration is modified, restart the svn Service as follows:

# Ps-aux | grep svnserve
# Kill-9 ID
# Svnserve-d-r/home/svn

(This error occurred a few days ago. I created two new projects and started the project to the following path. As a result, the persons under the path account of the above-level project could not log on, the final reason is that the startup directory must be the parent directory, that is, the svn directory. If the project directory under svn is started separately, there will be problems, if there are more than two .)

8. Test Server

You can use the svn client to try the test. The access directory is svn: // 192.168.8.18/the project account can use admin 123456 above to ensure that the access permission path folder is available. For example, check the following:

Now, the file transfer is complete!

However, if you want to use http for access, you can continue this operation.

3. Configure http support for the svn Server


1. Convert the SVN server password
Because the SVN server password is in plain text, the HTTP server does not support it, so you need to convert it to a format supported by HTTP. I wrote a Perl script to complete this job.
The script content is 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 and add content about the SVN server.
Edit/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. Change the svn directory owner to an apache account: chown-R apache. apache/home/svn/project/
(Note: If this step is missing in the original article, the permission issue may occur .)
4. Restart the Web Server:
#/Etc/init. d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: [OK]

5. Use a browser to access http: // 192.168.8.18/project/
Shows the test result:

Note: An error will be reported when you enter the account and password here. I am still looking for a solution. It is estimated that the svn password cannot be identified in http. If you have any experts, please help me solve the problem. Thank you!

This article is from the "ghost" blog, please be sure to keep this source http://fangwei009.blog.51cto.com/5234706/1622481

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.