Ubuntu上SVN服务器配置教程全讲解
2013-01-31 17:43
309 查看
(本文需要你有一个简单的SVN配置过程的了解,本文介绍了各个配置细节上的说明,是其他SVN教程所没有的)
配置过程了解可以看博文:http://blog.csdn.net/luopeiyuan1990/article/details/8557104
在SVN上的服务器的配置有这么几个关键的地方:
(本文介绍SVN服务器与apache结合)
这里配置文件里面的注释我没有删去,因为他们很多是对功能的说明,对维护很有帮助
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/ # Note, a literal /svn should NOT exist in your document root.
<Location /fitness>
# Uncomment this to enable the repository
DAV svn
# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /home/svn/
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
#AuthUserFile /home/svn/fitness/conf/passwd
# To enable authorization via mod_authz_svn (enable that module separately):
<IfModule mod_authz_svn.c>
AuthzSVNAccessFile /home/svn/fitness/conf/authz
</IfModule>
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user
Satisfy Any
#</LimitExcept>
</Location>
注意:其中 最后的Require valid-user 在正式使用的时候,需要被使用,而屏蔽掉 Satisfy Any
其中还有其他几个关键地方:
1:SVNParentPath /home/svn/ 是指你放 所有仓库的根目录
2:AuthName "Subversion Repository" 是在网页登陆时的提示信息
3:AuthUserFile /etc/subversion/passwd apache 在验证用户时使用的密码文件的目录
4:AuthzSVNAccessFile /home/svn/fitness/conf/authz 所有用户的权限问题的配置文件目录
然后就是他的所有文件的一个简单的写法示例了:如下:
### 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:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = mirze,test1
test = test2
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/]
@admin=rw
*=r
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
#是注释,其他的是说明文件。
admin = mirze,test1 这两个人,如果你需要加的话,随意
然后空行其他的普通用户
接着是仓库说明
[/] 为根目录
有其他仓库的话比如 kk的仓库加入如下:
[kk:/]
这些仓库与conf文件平行,
可以写成上面的明文密码形式,最好使用 htpasswd 生成 如下
sudo htpasswd -c /home/svn/project/conf/passwd test
中间是passwd文件位置 ,test 为用户,输入两次后,本文件就多了一行
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository
[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
anon-access = read 正式使用是最好改为 none 上面注释里写的很清楚。
最后,要外网访问 apache的话 还要更改 apache2.conf
sudo gedit /etc/apache2/apache2.conf(at linux )
# Server Name
ServerName XXXXXX
建议 XXXX 写为IP地址即可。
Adding group `subversion' (GID 1002) ...
Done.
zchx@ubuntu:~$ sudo adduser zchx subversion
Adding user `zchx' to group `subversion' ...
Adding user zchx to group subversion
Done.
zchx@ubuntu:~$ sudo adduser www-data subversion
Adding user `www-data' to group `subversion' ...
Adding user www-data to group subversion
Done.
sudo svn import -m "New import" /home/svnuser/src file:///home/svn/fitness 后面是仓库
在安装文件的conf目录下
svnserve.conf 、passwd 、authz三个文件,行最前端不允许有空格
运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:
zchx@ubuntu:~/Documents$ svnserve -d -r /home/svn/fitness/
zchx@ubuntu:~/Documents$ svn checkout svn://127.0.0.1/ --username mrze --password 123456 ./
svn: '.' is already a working copy for a different URL; run 'svn update' to complete it
zchx@ubuntu:~/Documents$ svn checkout svn://127.0.0.1/fitness/ --username mrze --password 123456 ./
A main.cpp
Checked out revision 1.
zchx@ubuntu:~/Documents$ ls
fitness ScadaData TCPtest.cpp
main.cpp Scada_Test_tool-2013-1-21.tar.gz TCPtest.cpp~
zchx@ubuntu:~/Documents$ cd fitness/
zchx@ubuntu:~/Documents/fitness$ ls
fitness main.cpp
zchx@ubuntu:~/Documents/fitness$
至此完毕,如果有不清楚,可以联系我 ,我是leo_luopy QQ:8944105 email : leo_luopy@139.com
配置过程了解可以看博文:http://blog.csdn.net/luopeiyuan1990/article/details/8557104
在SVN上的服务器的配置有这么几个关键的地方:
(本文介绍SVN服务器与apache结合)
这里配置文件里面的注释我没有删去,因为他们很多是对功能的说明,对维护很有帮助
apache的dav_svn.conf 文件
# dav_svn.conf - Example Subversion/Apache configuration#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/ # Note, a literal /svn should NOT exist in your document root.
<Location /fitness>
# Uncomment this to enable the repository
DAV svn
# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /home/svn/
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
#AuthUserFile /home/svn/fitness/conf/passwd
# To enable authorization via mod_authz_svn (enable that module separately):
<IfModule mod_authz_svn.c>
AuthzSVNAccessFile /home/svn/fitness/conf/authz
</IfModule>
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user
Satisfy Any
#</LimitExcept>
</Location>
注意:其中 最后的Require valid-user 在正式使用的时候,需要被使用,而屏蔽掉 Satisfy Any
其中还有其他几个关键地方:
1:SVNParentPath /home/svn/ 是指你放 所有仓库的根目录
2:AuthName "Subversion Repository" 是在网页登陆时的提示信息
3:AuthUserFile /etc/subversion/passwd apache 在验证用户时使用的密码文件的目录
4:AuthzSVNAccessFile /home/svn/fitness/conf/authz 所有用户的权限问题的配置文件目录
然后就是他的所有文件的一个简单的写法示例了:如下:
关于权限配置文件authz
### 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:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = mirze,test1
test = test2
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/]
@admin=rw
*=r
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
#是注释,其他的是说明文件。
admin = mirze,test1 这两个人,如果你需要加的话,随意
然后空行其他的普通用户
接着是仓库说明
[/] 为根目录
有其他仓库的话比如 kk的仓库加入如下:
[kk:/]
这些仓库与conf文件平行,
passwd文件
[users] test2 = 123456
可以写成上面的明文密码形式,最好使用 htpasswd 生成 如下
sudo htpasswd -c /home/svn/project/conf/passwd test
中间是passwd文件位置 ,test 为用户,输入两次后,本文件就多了一行
svnserve.conf文件
### This file controls the configuration of the svnserve daemon, if you### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository
[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
anon-access = read 正式使用是最好改为 none 上面注释里写的很清楚。
最后,要外网访问 apache的话 还要更改 apache2.conf
sudo gedit /etc/apache2/apache2.conf(at linux )
# Server Name
ServerName XXXXXX
建议 XXXX 写为IP地址即可。
一些配置过程中命令记录
zchx@ubuntu:~$ sudo addgroup subversionAdding group `subversion' (GID 1002) ...
Done.
zchx@ubuntu:~$ sudo adduser zchx subversion
Adding user `zchx' to group `subversion' ...
Adding user zchx to group subversion
Done.
zchx@ubuntu:~$ sudo adduser www-data subversion
Adding user `www-data' to group `subversion' ...
Adding user www-data to group subversion
Done.
sudo svn import -m "New import" /home/svnuser/src file:///home/svn/fitness 后面是仓库
在安装文件的conf目录下
svnserve.conf 、passwd 、authz三个文件,行最前端不允许有空格
运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:运行过程:
zchx@ubuntu:~/Documents$ svnserve -d -r /home/svn/fitness/
zchx@ubuntu:~/Documents$ svn checkout svn://127.0.0.1/ --username mrze --password 123456 ./
svn: '.' is already a working copy for a different URL; run 'svn update' to complete it
zchx@ubuntu:~/Documents$ svn checkout svn://127.0.0.1/fitness/ --username mrze --password 123456 ./
A main.cpp
Checked out revision 1.
zchx@ubuntu:~/Documents$ ls
fitness ScadaData TCPtest.cpp
main.cpp Scada_Test_tool-2013-1-21.tar.gz TCPtest.cpp~
zchx@ubuntu:~/Documents$ cd fitness/
zchx@ubuntu:~/Documents/fitness$ ls
fitness main.cpp
zchx@ubuntu:~/Documents/fitness$
至此完毕,如果有不清楚,可以联系我 ,我是leo_luopy QQ:8944105 email : leo_luopy@139.com
相关文章推荐
- CruiseControl 安装 配置 教程 实例 搭建服务器 (CruiseControl + git/svn)
- Ubuntu安装配置JDK、Tomcat、SVN服务器
- Ubuntu下SVN服务器的安装与配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- windows下架设svn服务器,svn配置详细图文教程
- Ubuntu 14 下配置 svn服务器 svnserve
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- Ubuntu 10.04下配置svn服务器 以及使用kdesvn
- ubuntu下SVN服务器安装配置和钩子
- ubuntu 下配置SVN服务器(有图有真相)
- Ubuntu 上配置 SVN(subversion) 服务器
- ubuntu下七步配置好SVN服务器
- svn使用教程(服务器安装与客户端安装配置)
- Ubuntu下SVN服务器安装和配置
- ubuntu下svn服务器的安装配置
- ubuntu下SVN服务器安装配置 下的svn 常用命令
- ubuntu下七步配置好SVN服务器