Use Subversion to configure the SVN service in CentOS

Source: Internet
Author: User
(1) modify httpd configuration vi/etc/httpd/conf/httpd. confListen80Listen10.88.0.26: 8080ServerName10. 88.0.26: 80 (2) svn installation configuration 1. install: yuminstallsubversion // rpm-qa | grepsubversion check whether yu (1) has been installed to modify httpd configuration
Vi/etc/httpd/conf/httpd. conf
Listen 80
Listen 10.88.0.26: 8080
ServerName 10.88.0.26: 80

(2) svn installation configuration
1. install: yum install subversion // rpm-qa | grep subversion to check whether the version is installed
Yum install mod_dav_svn
2. svn configuration create svn version Library Directory (multiple directories can be created ):
Create a folder:
# Mkdir-p/opt/svndata/repos
Create the svn version Library:
# Svnadmin create/opt/svndata/repos
Modify the svn version Library configuration file version Library:
# Vi/opt/svndata/repos/conf/svnserve. conf
Modify the content:
[General] item
Anon-access = none
Auth-access = write
Password-db =/opt/svndata/repos/conf/passwd
Authz-db =/opt/svndata/repos/conf/authz
Realm = repos
3 vi/opt/svndata/repos/conf/authz
Add:
[Groups]
Admin = jcq
[/]
@ Admin = rw
* =
4. configure the svn repository vi/etc/httpd/conf. d/subversion. conf
Confirm that the following two rows exist
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so otherwise, yum installmod_dav_svn
Add at the end:

DAV svn
SVNParentPath/opt/svndata/repos

AuthzSVNAccessFile/opt/svndata/repos/conf/authz
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile/opt/svndata/repos/conf/htpasswd. users
Require valie-user


5. create an authentication document, which is equivalent to passwd when svn is used.
Htpasswd-cm/data/subversion/conf/htpasswd. users jcq
New password:
Re-type new password:
6 Run: svnserve -- listen-host 10.88.0.26 -- listen-port 3690-r/opt/svndata/repos/-d
7. open port 3690 in the firewall
Vi/etc/sysconfig/ Iptables
Http://www.linuxso.com/linuxrumen/10490.html
Note: modifications to user configuration files take effect immediately without the need to restart svn.
Passwd. conf [users] is required. the file format is as follows:
[Users]
= The following lists the users who want to access svn. each user has a row, for example:
[Users]
Username = password
Configure svn user access permissions:
# Vi/opt/svn/conf/authz. conf
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:
[Groups]
=,
One user group can contain one or more users separated by commas.
Version library directory format:
[ <版本库> :/Project/directory]
@ <用户组名> = <权限>
<用户名> = <权限>
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/opt/svndata. [/] indicates setting permissions for all vertices.
[Repos:/] indicates that you have set permissions for version Library repos.
[Repos2:/abc] indicates setting permissions for the abc project in the version Library repos2.
[Repos2:/abc/aaa] indicates setting permissions for the aaa Directory of the abc project in the version Library repos2
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.
Example:
[Groups]
Admin = alan
[/]
@ Admin = rw
[Repos1:/abc/aaa]
King = rw
[Repos2:/pass]
King =
Svn configuration is complete.
3. start svn to create a user who starts svn
# Useradd svn
# Passwd svn
Set the user svn password as prompted
Allow user svn to access the version Library:
# Chown-R svn: svn/opt/svndata
Start svn
# Su-svn-c "svnserve-d listen-port 9999-r/opt/svndata"
Where:
Su-svn indicates to start svn as 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/svndata specifies that the root directory is/opt/svndata
Check:
Ps-ef | grep svnserve
If the following information is displayed, the instance is successfully started:
Svn 6941 1 0? 00:00:00 svnserve-d listen-port 9999-r/opt/svndata
There are many ways to access svn through web. for details, refer to configuring websvn or bsSvnBrowser.
After all the configurations are completed, you can use the client SVN for operations.
Server Test:
# Cd/tmp
# Mkdir test
# Touch test.txt
# Svn import/tmp/test/file: // opt/svndata/repos-m "this is thiefirst import"
# Mkdir-p/tmp/test2
# Cd/tmp/test2
# Svn co file: // opt/svndata/repos/tmp/test2/
Or:
# Svn co svn: // {your-server-ip}: 9999/repos/
You should be able to see the file test.txt.
Test method:
# Telnet {your-server-ip} 9999 check whether the port is connected
If the above check fails, it may be that iptables is not enabled. you can set iptables:
# Vi/etc/sysconfig/iptables
Add:
-A output-p tcp-m tcp -- dport 9999-j ACCEPT
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.