MOD_DAV_SVN is an Apache -connected svn module
Yum Install subversion mod_dav_svn httpd
A simple description of the configuration file,
Svnparentpath Description You can create multiple SVN projects under the specified directory
-----------------------
Vim/etc/httpd/conf.d/subversion.conf
LoadModule Dav_svn_module modules/mod_dav_svn.so
LoadModule Authz_svn_module modules/mod_authz_svn.so
#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/VAR/WWW/SVN". Each repository
# must is readable and writable by the ' Apache ' user. Note that if
# SELinux is enabled, the repositories must are labelled with a context
# which httpd can write to; This would happen by default for
# Directories created In/var/www. Use "Restorecon-r/var/www/svn"
# to label the repositories if upgrading from a previous release.
#
#
# to create a new repository "Http://localhost/repos/stuff" using
# This configuration, run as root:
#
# # CD/VAR/WWW/SVN
# # Svnadmin Create Stuff
# # Chown-r Apache.apache Stuff
#
<Location/repos>
DAV SVN
Svnparentpath/var/www/svn
#
# # Limit Write permission to list of valid users.
# <limitexcept GET PROPFIND OPTIONS report>
# # Require SSL connection for password protection.
# # Sslrequiressl
#
AuthType Basic
AuthName "Authorization Realm"
Authuserfile/etc/subversion/passwdfile
Require Valid-user
# </LimitExcept>
</Location>
-----------------------------
Add a password using Apache's own commands
[Email protected] www]# htpasswd-c/etc/subversion/passwdfile admin
New Password:
Re-type New Password:
Adding Password for user admin
Create an SVN repository
CD /VAR/WWW/SVN
Svnadmin Create mytest0531
Configuring repository-related files
[Email protected] conf]# pwd
/var/www/svn/mytest0531/conf
[email protected] conf]# LL
Total
-rw-r--r--1 root root 05-31 16:05 Authz
-rw-r--r--1 root root 309 05-31 16:05 passwd
-rw-r--r--1 root root 2279 05-31 16:05 svnserve.conf
Configuration file Description
svnserve.conf file, The file configuration entry is divided into the following 5 items:
Anon-access: controls the permissions of non-authenticated users to access the repository.
Auth-access: controls the permissions of the authentication user to access the repository.
Password-db: Specifies the user name password file name.
AUTHZ-DB: Specifies the permission profile file name through which path-based access control can be implemented.
Realm: Specifies the authentication domain for the repository, which is the name of the authentication domain that is prompted at logon. If the authentication domain of the two repositories is the same, it is recommended to use the same username password data file
passwd File
Password-db = passwd
Authz-db = Authz
Authz File
[Users]
Harry = Harryssecret
Sally = Sallyssecret
Authz File
[Groups]
harry_and_sally = harry,sally
[TESTSVN:/]
@harry_and_sally = RW
* = R
TESTSVN corresponds to the repository name, / The directory that corresponds to SVN,/var/www/svn
Start svn
Svnserve-d-R/VAR/WWW/SVN
Test access
http://192.168.0.209/svn/mytest0531
=======================================================================
SVN test for permissions
One question: What permissions do users with Web Access have??
In the httpd directory for The SVN configuration file, theadmin Test User only has browse permissions.
Subversion.confprovides a way for SVN clients to access SVN .
Permission tests:
Web users
Admin
SVN Client User ( user set in svn config file )
User01
User02
User03
Configuration content is as follows
[email protected] conf]# cat svnserve.conf |grep-v ' ^# ' |sed/^$/d
[General]
Anon-access = None
auth-access = Write
Password-db = passwd
Authz-db = Authz
------------------------------
Anon-access: controls the permissions of non-authenticated users to access the repository. can be set to write,read,none
Auth-access: controls the permissions of the authentication user to access the repository.
Password-db: Specifies the user name password file name.
AUTHZ-DB: Specifies the permission profile file name through which path-based access control can be implemented.
Realm: Specifies the authentication domain for the repository, which is the name of the authentication domain that is prompted at logon. If the authentication domain of the two repositories is the same, it is recommended to use the same username password data file
[email protected] conf]# cat passwd |grep-v ' ^# ' |sed/^$/d
[Users]
User01 = User01
User02 = User02
USER03 = user03
Format : user name = password
[email protected] conf]# cat Authz |grep-v ' ^# ' |sed/^$/d
[Aliases]
[Groups]
User01 = User01
user02_03 = user02,user03
[mytest0531:/]
@user01 = WR
@user02_03 =r
[Groups] Grouping Options
[mytest0531:/] for all directories under mytest0531,User01 has read and write permissions,User02, anduser03 .
Test Tool TortoiseSVN
1• Install TortoiseSVN
2• Connect, right-click in the folder, select SVN Checkout ...
3· Select OK
4• Prompt for user name and password
5• Incorrect input, no hint, but no connection. Can be re-entered.
6• login with test account User02
7• download SVN files to the local C:\Users\Ninglianjie\mytest0531 directory
8· Delete the "new text document. txt" and upload it with User02 to see the results as follows :
Select SVN Commitand enter the user02 password user02
9• after submitting with User01 password user01 , the results are as follows
It can be deleted normally.
Browse with a Web browser, as follows
Enter Address http://192.168.0.209/svn/mytest0531/
User name admin, password admin, "new text document. txt" has been deleted
4. Create a user to start SVN
?
1234 |
[[email protected] ~] # useradd svn #如果提示svn账户已存在, execute the following command [[email protected] ~] # passwd svn # #根据提示修改下密码, can not be too simple to use the common password [[email protected] ~] # chown -r svn:svn /home/svn/ # #允许用户svn访问版本库 [[ Email protected] ~] # chmod –r o+rw /home/ svn # #解决windows检出提交提示/home/svn/db/txn-current-lock ' ERROR |
5. Configure the SVN port
?
1 |
[[email protected] ~] # vi /etc/httpd/conf/httpd.conf |
Found it
#Listen 12.34.56.78:80 this line,
Listen 9999 # #9999就是svn的端口, the default is 80, you can change it to what you want. Using the default 80 port is not recommended
5. Configure httpd
?
1 |
[[email protected] ~] # vi /etc/httpd/conf.d/subversion.conf |
Modify the contents of the file as:
<Location/svn>
DAV SVN
Svnlistparentpath on
Svnparentpath/home/svn
AuthType Basic
AuthName "Authorization"
authuserfile/home/svn/conf/pwd.conf # #对应你的用户配置文件
authzsvnaccessfile/home/svn/conf/authz.conf # #对应你的权限配置文件
Require Valid-user
</Location>
Save Exit!
Restart the httpd service.
?
123 |
[[email protected] ~] # service httpd restart 停止 httpd: [确定] 正在启动 httpd: [确定] |
The configuration of the table name HTTPD has successfully started successfully when the above words appear.
6. Start SVN
?
1 |
[[email protected] ~] # svnserve -d -r /home/svn/ |
7. See if the SVN service is working
?
1234 |
[[email protected] ~] # ps aux|grep svn ##出现以下内容说明svn服务已经成功启动 root 8610 0.0 0.0 152864 740 ? Ss 11:25 0:00 svnserve -d -r /home/svn/repos1/ root 13128 0.0 0.0 103252 876 pts/0 S+ 14:00 0:00 grep svn |
8. Go to browser access.
Enter in the browser: <location/svn> in the server ip+ port +httpd configuration.
such as: HTTP://192.168.1.1:9999/SVN
You will be prompted to enter a user name password.
9. Summary
Well, there's not much to summarize, these are my results from the online synthesis of multiple posts, I hope to give you some help.
Apache HTTPD-based SVN server Setup and configuration in Linux