ubuntu下svn服务器的安装配置
来源:互联网 发布:arm用什么软件编程 编辑:程序博客网 时间:2024/04/29 11:34
1.SubVersion服务安装
2
sudo apt-get install libapache2-svn
2.服务器配置
2.1相关用户、组的设定
将自己和“www-data”(Apache 用户)加入组subversion中
2
sudo usermod -G subversion -a www-data
看下结果:
这里注意,需要注销然后再登录以便您能够成为 subversion 组的一员,然后就可以执行签入文件(Check in,也称提交文件)的操作了
仓库位置我们就放在/home/svn下吧:
2.2配置subversion
编辑/etc/subversion/config 文件,修改相关设置
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[miscellany]
global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store
### Set mime-types-file to a MIME type registry file, used to
### provide hints to Subversion's MIME type auto-detection
### algorithm.
# mime-types-file = /path/to/mime.types
### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes
### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
### file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?'). All entries which match (case-insensitively) will be
### applied to the file. Note that auto-props functionality
### must be enabled, which is typically done by setting the
### 'enable-auto-props' option.
*.c = svn:eol-style=native
*.cpp = svn:eol-style=native
*.h = svn:eol-style=native
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=native;svn:executable
*.txt = svn:eol-style=native
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
Makefile = svn:eol-style=native
*.php = svn:keywords=Id Rev Date URL Revision Author
global-ignores是提交时忽略的文件类型,启用auto-props后,让subversion自动添加Id,Revision等keywords
这样就可以使用svn的keywords了。特别是eclipse里就方便多了。设置一下就可以使用
$$Id$$、$$Reversion $$、$$Date $$、$$Author$$ 、$$URL$$作为注释模板的内容,方便极了。
如果在客户端访问subversion版本库时出现这个错误:
svnserve.conf:102: Option expected
为什么会出现这个错误呢,就是因为subversion读取配置文件svnserve.conf时,无法识别有前置空格的配置文件。
要避免出现这个错误,应该在去掉这些行前的#时,也要顺手去掉前面的空格。
3.apache mod_dav_svn 配置
通过 WebDAV 协议访问(http://)
关于WebDAV :
WebDAV (Web-based Distributed Authoring and Versioning) 一种基于 HTTP 1.1协议的通信协议.它扩展了HTTP 1.1,在GET、POST、HEAD等几个HTTP标准方法以外添加了一些新的方法,使应用程序可直接对Web Server直接读写,并支持写文件锁定(Locking)及解锁(Unlock),还可以支持文件的版本控制。
编辑 /etc/apache2/mods-available/dav_svn.conf :
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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 /svn>
#enable the repository
DAV svn
# Set this to the path to your repository
#SVNPath /home/svn/vod
# 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.
#用这个,以便放多个repository
SVNParentPath /home/svn
# 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/dav_svn.passwd
# To enable authorization via mod_authz_svn
#mod_authz_svn配置文件的位置
AuthzSVNAccessFile /etc/subversion/dav_svn.authz
# 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
#</LimitExcept>
</Location>
重启 Apache 2 Web 服务器
4.创建 SVN 文件仓库
2
3
4
5
6
7
sudo mkdir myproject
#更改版本库所属用户、组
sudo chown -R root:subversion myproject
sudo svnadmin create /home/svn/myproject
#赋予组成员对所有新加入文件仓库的文件拥有相应的权限:
sudo chmod -R g+rws myproject
5.密码文件dav_svn.passwd的创建
它会提示你输入密码,当您输入了密码,该用户就建立了。“-c”选项表示创建新的/etc/subversion/dav_svn.passwd 文件,所以user_name所指的用户将是文件中唯一的用户。如果要添加其他用户,则去掉“-c”选项即可:
sudo htpasswd /etc/subversion/dav_svn.passwd other_user_name
6.授权配置文件dav_svn.authz
这里我指定了两个组:管理员组和测试组,指定了两个仓库(vod 、 ThinkPHP 和ftpuserms)的权限 。
vod仓库下管理员组设置为读写权限,测试组只有读的权限
ThinkPHP仓库下管理员组设置为读写权限,测试组只有读的权限
定义ftpuserms储存库下test目录的访问权限:
禁止所有用户访问,星号代表所有用户,权限为空代表没有任何权限
打开test3用户的读权限,打开administrator组的读写权限
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
administrator=admin,yuan
tester=test1,test2,test3
[vod:/]
@administrator=rw
tester=r
[ThinkPHP:/]
@administrator=rw
tester=r
[ftpuserms:/test]
@administrator=rw
*=
test3=r
启动SVN服务器:
您可以通过下面的命令来访问文件仓库:
创建目录试试:
如果在Check in的时候遇到如下错误:
Can’t open ‘/home/svn/myproject/db/txn-current-lock’: Permission denied
查看txn-current-lock文件的权限和用户以及组信息,应该类似于:
-rw-rwSr– 1 root subversion 0 2009-06-18 15:33 txn-current-lock
除了权限以外,用户及其组如果不对,则仍然会遇到上述问题,可以再次运行命令:
- ubuntu下svn服务器的安装配置
- ubuntu下svn服务器的安装配置
- ubuntu下svn服务器的安装配置
- Ubuntu下SVN服务器的安装和配置
- Ubuntu下SVN服务器的安装和配置
- Ubuntu下SVN服务器的简单安装和配置
- Ubuntu下SVN服务器的安装与配置
- Ubuntu/Centos下SVN服务器的安装和配置
- Ubuntu下 SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- ubuntu下SVN服务器安装配置
- jedis 连接池的使用
- Android Layout:RalativeLayout
- 远程桌面(3389)连接超出最大连接数
- jquery datepicker 效果
- 什么是敏捷开发中的Scrum方法
- ubuntu下svn服务器的安装配置
- shell语法之case
- C#编写的串口类
- 一份好的ARM体系结构学习笔记
- django的安装及web部署(转载)
- android获得手机信息
- Jredis操作redis的入门级例子
- android修改framework层的代码后怎么安装才能看到效果
- Android蓝牙系统(精华篇)