SVN + Linux + Apache configuration-Linux Enterprise Application-Linux server application information. For details, refer to the following section. It took a day to finally get it done:
1 install SVN and apache:
There are many installation tasks on the Internet, because fedora is used to directly run yum. Note that apache is named httpd in yum. To enable apache to work with SVN access control, the mod_authz_svn.so library must be installed, search for svn in yum, and apache will see the software package. finally, make sure that there are four files under/usr/lib/httpd/modules: mod_dav.so, mod_dav_fs.so, mod_dav_svn.so, the last two files of mod_authz_svn.so can be found in % SVN_HOME %/bin. (the files in the moudules directory after installation do not exist.
After installing SVN: Use svnserve-d to start the background service, and use netstat-ntlp to check whether port 3690 of the program is bound to check whether the svnserve service is started, and killall svnserve command to disable the service
After the httpd service is started, the browser can directly access the server IP Address
2 create a Linux SVN management account
The new linux Account used to manage SVN accounts has been added to the SVN group. The account name I created is svnadand the corresponding group is svnadand the apache account is added to the SVN group, make sure that apache has all permissions on all the files in the/home/svn_group directory. otherwise, an error may occur when you access SVN through the web. For example, if the browser displays "cocould not open the requested SVN filesystem, then there is an access deny error in/etc/http/logs/error_log. error_log is the place where apache errors are recorded. You should check the errors here and search for related errors online.
3. Create the SVN root directory and related repository (that is, the project directory)
Create the SVN root directory mkdir SVNRoot (of course, the name can be customized) under/home/svn_and enter SVNRoot to create the project directory. First, create a C and enter C, run the svnadmin create/home/svnad/ C command. (I have tried to create svnadmin create -- fs-type fsfs/home/svnroot/repository/test, no difference found at the moment) create a reposityory, after which the C Directory should have the following content:
Conf dav db format hooks locks README.txt
You can configure user permissions and users in conf. User Permissions are basically the same as the multi-database permission settings described below. Users are composed of username = password and are not encrypted in plaintext, because apache is used to control access permissions.
In addition, after this step, run commands such as svnserve-d-r/home/svnroot/repository/test1 -- listen-host 192.168.1.18 to start the svn service and run svn: // access the svn server at 192.168.1.18. If you do not want to use apache, this step can be completed.
4. Bind apache to svn
Confirm/etc/httpd/conf. d/has subversion. conf file. If not, check/etc/httpd/conf/httpd. conf contains the following four lines, which are not commented out:
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
Then add the configuration information in httpd. conf or subversion. conf (remove unnecessary spaces and use the "" sign to include spaces ):
The configuration has the following meanings:
# "/Svn" is the access path specified on the url. You need to enter this path for customer access.
DAV "svn" # declare svn
SVNPath "/home/svn_/ SVNRoot"
# "E: \ svn" is the repository directory of svn on the server.
SVNParentPath "/home/svn_/ SVNRoot"
'# This variable can be declared if multiple projects exist in a directory.
# There are two svn configurations in apache, which can be used together. One is apache's own authentication mechanism,
# Perform unified authentication for users entering the/repos directory,
# One is the application of svn authentication, which allows you to perform permission control at the directory level,
# The same as setting permissions when svn is started independently.
### Apache auth begin
AuthType Basic
AuthName "Subversion" # Authentication Name
AuthUserFile "/home/svnad/ SVNRoot/passwd"
# "/Home/svnad/ SVNRoot/passwd" is stored using htpasswd-m # "/home/svnad/ SVNRoot/passwd" user
# The encrypted file of the generated user name and password. Note: The path here cannot contain spaces.
Require valid-user # declares that a valid user can access
### Apache auth end
### Svn auth begin
AuthzSVNAccessFile "/home/svnad/ SVNRoot/conf/authz"
# The "/home/svnad/ SVNRoot/conf/authz" file is written according to the rules of % respository % #/conf/authz.
# It is the file format required by svn for user permission reading, and the format required by mod_authz_svn.so.
# SVNIndexXSLT "d: \ svnindex. xsl"
# D: \ svnindex. xsl is a display template that you can customize. The template is designed and displayed in html.
# It will be more beautiful.
# Authentication if necessary.
Satisfy Any
Require valid-user # declares that a valid user can access
### Svn auth end
5. Users and permissions
SVN users are replaced by apache users:
Htpasswd/home/svnad/ SVNRoot/passwd-cm username to create a user file. c Indicates creating a file, and m indicates md5 encrypted storage.
You can use htpasswd/home/svnad/ SVNRoot/passwd-m username to add users later.
Use htpasswd/home/svnad/ SVNRoot/passwd-D username to delete a user
Permission management
The following table describes how to create an authz file under/home/svn_/ SVNRoot:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### Files.
### As shown below each section defines authorizations for the path and
### (Optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to
### Single user, to a group of users defined in a special [groups]
### Section, or to anyone using the '*' wildcard. Each definition can
### Grant read ('R') access, read-write ('rw ') access, or no access
###('').
[Groups]
# Harry_and_sally = harry, sally
Admin = AD
HoAdmin = admin2
Reader = test
[/]
@ Reader = r
[C:/]
@ Admin = rw
[Holiday:/]
@ HoAdmin = rw
# [/C]
# @ Admin = rw
# @ Reader = r
[/COPYFILE]
@ Reader =
# [/Foo/bar]
# Harry = rw
# * =
# [Repository:/baz/fuz]
# @ Harry_and_sally = rw
# * = R
Here we assume that there are two projects in repository: C and Holiday. Under/home/AD/SVNRoot (SVN root directory), there are three accounts: test, admin2, AD belongs to three groups: reader, admin, admin, and reader. In addition to the COPTFILE files in Project C, the Administrator Group has all the read and write permissions for the Holiday project, admin has read and write permissions for only Project C.
Now, we can use http: // localhost/svn/C/or another type of http to access SVN or verify permissions for all configuration files.
Svn gui clients such as rapidsvn can directly enter the above url. Considering web access, you may need to set up a firewall. because apache embedded svn is used, you do not need to start the svn service. You only need to start the httpd service.
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.