Centos6.6 SVN configuration based on apache Environment

Source: Internet
Author: User

Centos6.6 SVN configuration based on apache Environment
Version: Centos6.6 _ 64
Environment: apache has been installed
Yum install mod_dav_svn subversion
After the installation is complete, the configuration file appears. If the configuration file does not appear, you can create it yourself.
Modify or create Subversion config file/etc/httpd/conf. d/subversion. conf

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location/svn> (Location under apache)
DAV svn
SVNPath/home/svn/myproject (specify the path of the resource library)
SVNParentPath/home/svn (use this option if multiple libraries exist)
SVNListParentPath on (enable this option to list all databases under ParentPath)
AuthType Basic (the authentication type is Basic authentication)
AuthName "Subversion Repository" (Authentication Name, which is displayed in the IE interface with the title)
AuthUserFile/etc/apache2/dav_svn.passwd (authentication Password File)
# AuthzSVNAcessFile/etc/apache2/dav_svn.authz (directory permission file)
Require valid-user (authentication is required, that is, anonymous access is not allowed)
</Location>

Apprepo example:
[Root @ AY140624153909325b49Z ~] # Cat/etc/httpd/conf. d/subversion. conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

<Location/svn>
DAV svn
SVNParentPath/var/www/svn
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile/etc/svn-auth-users account and password
AuthzSVNAccessFile/etc/svn-access-control user permission control
Require valid-user
</Location>
[Root @ AY140624153909325b49Z ~] #

Create a database access user:
# Create testuser ##
The-c parameter is required for the first creation.
Htpasswd-cm/etc/svn-auth-users testuser
New password:
Re-type new password:
Adding password for user testuser

# Create testuser2 ##
Htpasswd-m/etc/svn-auth-users testuser2
New password:
Re-type new password:
Adding password for user testuser2


========================================================== ======================================
Create and configure SVN repository
Mkdir/var/www/svn
Cd/var/www/svn

Svnadmin create testrepo
Chown-R apache. apache testrepo
After creation:
[Admin @ localhost myapp] $ ll
Total usage 28
Drwxr-xr-x. 2 apache 4096 July 30 15:10 conf
Drwxr-xr-x. 3 apache 4096 Aug 17 15:29 dav
Drwxr-sr-x. 6 apache 4096 July 30 15:47 db
-R --. 1 apache 2 July 30 15:10 format
Drwxr-xr-x. 2 apache 4096 July 30 15:10 hooks
Drwxr-xr-x. 2 apache 4096 July 30 15:10 locks
-Rw-r --. 1 apache 229 July 30 15:10 README.txt
[Admin @ localhost myapp] $

Cd conf/

[Admin @ localhost conf] $ ll
Total usage 12
-Rw-r --. 1 apache 1080 authz July 30 15:10
-Rw-r --. 1 apache 309 15:10 passwd
-Rw-r --. 1 apache 2279 July 30 15:10 svnserve. conf
[Admin @ localhost conf] $




If the firewall is enabled, modify the CONTEXT value.
# If you have SELinux enabled (you can check it with "sestatus" command )##
# Then change SELinux security context with chcon command ##
Chcon-R-t httpd_sys_content_t/var/www/svn/testrepo
# Following enables commits over http ##
Chcon-R-t httpd_sys_rw_content_t/var/www/svn/testrepo

Restart the apache service
Restart apache:
/Etc/init. d/httpd restart
/Etc/rc. d/init. d/httpd restart



Note:
Goto http: // localhost/svn/testrepo address and you shoshould see something like following, write username and password:
Url: http: // localhost/svn/testrepo


If user name and password verification fails
Symptom: Enter the user name and password, and click LOGIN to skip.


Solution:
First, check the svnserve. conf file to see if you want to remove the pair # Before password-db = passwd and use the top level;
Similarly, if authz-db = authz, change realm = My First Repository to your own server address,
Remove the # number in the front, and check whether the directory format in the authz file is correct. Use/to Configure permissions.

Edit: access control file
[Admin @ localhost tmp] $ cat svn-access-control
[Groups]
Devgroup = testuser, testuser2
Testgroup = tester

[/]
* = R
@ Devgroup = rw
Devgroup = rw

[Testrepo:/]
@ Devgroup = rw
@ Testgroup = r

[Testrepo:/trunk]
@ Devgroup = rw
@ Testgroup = r

[Testrepo:/tags]
@ Devgroup = rw
@ Testgroup = r

[Testrepo:/]
@ Testgroup = r

[Testrepo:/trunk]
@ Testgroup = r

[Testrepo:/tags]
@ Testgroup = r
[Admin @ localhost tmp] $





Configure repository configuration Library File

To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve. conf file:
# Disable anonymous access ## anon-access = none ## Enable access control ## authz-db = authz
# Disable anonymous access ##
Anon-access = none
# Enable access control ##
Authz-db = authz




Add code library:
Create trunk, branches and tags structure under myapprepo
Create "template" directories with following command:
Mkdir-p/tmp/svn-structure-template/{trunk, branches, tags}
Then import template to project repository using "svn import" command:
Svn import-m'initial import '/tmp/svn-structure-template/http: // localhost/svn/myapprepo/
Adding/tmp/svn-structure-template/trunk
Adding/tmp/svn-structure-template/branches
Adding/tmp/svn-structure-template/tags Committed revision
Committed revision 4.
========================================================== ====================================
Reference: http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/

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.