服务器

当前位置:首页 > 服务器 >

Linux下SVN服务器搭建

时间:2015-06-09        阅读:次        QQ群:182913345

一、 下载所需软件
subversion-1.6.19.tar.bz2
apr-1.4.6.tar.bz2
apr-util-1.5.1.tar.bz2
sqlite-amalgamation-3.6.13.tar.gz
 
二、 开始安装
localhost ~ # tar vjxf apr-1.4.6.tar.bz2
localhost ~ # cd apr-1.4.6
localhost apr-1.4.6 # ./configure
localhost apr-1.4.6 # make
localhost apr-1.4.6 # make install
localhost ~ # tar vjxf apr-util-1.5.1.tar.bz2
localhost ~ # cd apr-util-1.5.1
localhost apr-util-1.5.1 # ./configure –with-apr=/usr/local/apr/
localhost apr-util-1.5.1 # make
localhost apr-util-1.5.1 # make install
localhost ~ # tar vzxf sqlite-amalgamation-3.6.13.tar.gz
localhost ~ # cd sqlite-3.6.13
localhost sqlite-3.6.13 # ./configure
localhost sqlite-3.6.13 # make
localhost sqlite-3.6.13 # make install
localhost # tar vjxf subversion-1.6.19
localhost # cd subversion-1.6.19
localhost subversion-1.6.19 # ./configure –prefix=/usr/local/subversion –with-apr=/usr/local/apr/ –with-apr-util=/usr/local/apr/
localhost subversion-1.6.19 # cp /usr/local/lib64/* /lib64/
localhost subversion-1.6.19 # make && make install
localhost subversion-1.6.19 # ls /usr/local/svn/
 
有如下目录,并且编译过程中无错误发生则安装成功。
bin/     include/     lib/     share/
 
三、开始配置
localhost ~ # useradd svn
localhost ~ # PATH=$PATH:/usr/local/svn/bin
localhost ~ # export PATH #把SVN命令加到默认路径
 
四、服务器配置
1,新建一个目录用于存储SVN所有文件
# mkdir /home/svn
 
2,新建一个版本仓库
# svnadmin create /home/svn/project
 
3,初始化版本仓库中的目录
# mkdir project project/server project/client project/test (建立临时目录)
# svn import project/ file:///home/svn/project -m “初始化SVN目录”
# rm -rf project (删除临时建立的目录)
 
4,添加用户
要添加SVN用户非常简单,只需在/home/svn/project/conf/passwd文件添加一个形如“username=password”的条目就可以了.为了测试,我添加了如下内容:
[users]
# harry = harryssecret
# sally = sallyssecret
pm = pm_pw
server_group = server_pw
client_group = client_pw
test_group = test_pw
 
5,修改用户访问策略
/home/svn/project/conf/authz记录用户的访问策略,以下是参考:
[groups]
project_p = pm
project_s = server_group
project_c = client_group
project_t = test_group
 
[project:/]
@project_p = rw
* =
 
[project:/server]
@project_p = rw
@project_s = rw
* =
 
[project:/client]
@project_p = rw
@project_c = rw
* =
 
[project:/doc]
@project_p = rw
@project_s = rw
@project_c = rw
@project_t = rw
* =
以上信息表示,只有pm有根目录的读写权,server_group能访问server目录,client_group能访问client目录,所有人都可以访问doc目录.
 
6,修改svnserve.conf文件,让用户和策略配置升效.
svnserve.conf内容如下:
[general]
anon-access = none
auth-access = write
password-db = /home/svn/project/conf/passwd
authz-db = /home/svn/project/conf/authz
 
7,启动服务器
# svnserve -d -r /home/svn
 
8,测试服务器
# svn co svn://192.168.60.10/project
Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for ‘root':
Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Username: server_group
Password for ‘server_group':
svn: Authorization failed ( server_group没用根目录的访问权 )
 
# svn co svn://192.168.60.10/project
Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for ‘root':
Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Username: pm
Password for ‘pm':
A    project/test
A    project/server
A    project/client
Checked out revision 1.  ( 测试提取成功 )
 
# cd project/server
# vim main.c
# svn add main.c
# svn commit main.c -m “测试一下我的C程序,看什么看,不行啊??”
Adding         main.c
Transmitting file data .
Committed revision 2.  ( 测试提交成功 )

上一篇:解决方法:远程计算机需要网络级别身份验证

下一篇:Linux查看apache、php、mysql配置文件路径的方法

扫一扫,更多精彩内容推送

PHP技术分享

分享PHP技术,前端技术,数据库,SEO优化,服务器,网络安全等知识,是php程序员工作学习的好帮手!

Copyright © 2013-2015.PHP技术分享 www.php520.cn  版权所有  网站地图    PHP学习交流群

免责声明:网站内容收集于互联网,本网站不承担任何由于内容的合法性及健康性所引起的争议和法律责任。

欢迎大家对网站内容侵犯版权等不合法和不健康行为进行监督和举报。 沪ICP备15014499号-2