我的CSDN博客地址:[url]http://blog.csdn.net/qidong7[/url]
SVN Server详细配置手册
系统环境
CentOS 6.4 最小化安装(关闭iptables和selinux) + ssh + yum
一,安装必须的软件包.
yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced
说明:
subversion (SVN服务器)
mysql-server (用于codestriker)
httpd mod_dav_svn mod_perl (用于支持WEB方式管理SVN服务器)
sendmail (用于配置用户提交代码后发邮件提醒,可以关闭)
wget gcc-c++ make unzip perl* (必备软件包)
ntsysv vim-enhanced (可选)
二,基本的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 = server1,server2,server3
project_c = client1,client2,client3
project_t = test1,test1,test1
[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 = r
@project_c = r
@project_t = r
* =
说明:以上信息表示,只有project_p用户组有根目录的读写权。r表示对该目录有读权限,w表示对该目录有写权限,rw表示对该目录有读写权限。最后一行的* =表示,除了上面设置了权限的用户组之外,其他任何人都被禁止访问本目录。这个很重要,一定要加上!
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
注意:如果修改了svn配置,需要重启svn服务,步骤如下:
# ps -aux|grep svnserve
# kill -9 ID号
# svnserve -d -r /home/svn
8,测试服务器
# svn co svn://192.168.1.77/project
Authentication realm: 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for 'root':
Authentication realm: 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: 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for ‘root’:
Authentication realm: 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Username: pm
Password for ‘pm’:
A project/test
A project/server
A project/client
Checked out revision 1. ( 测试提取成功 )
SVN Server详细配置手册
系统环境
CentOS 6.4 最小化安装(关闭iptables和selinux) + ssh + yum
一,安装必须的软件包.
yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced
说明:
subversion (SVN服务器)
mysql-server (用于codestriker)
httpd mod_dav_svn mod_perl (用于支持WEB方式管理SVN服务器)
sendmail (用于配置用户提交代码后发邮件提醒,可以关闭)
wget gcc-c++ make unzip perl* (必备软件包)
ntsysv vim-enhanced (可选)
二,基本的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 = server1,server2,server3
project_c = client1,client2,client3
project_t = test1,test1,test1
[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 = r
@project_c = r
@project_t = r
* =
说明:以上信息表示,只有project_p用户组有根目录的读写权。r表示对该目录有读权限,w表示对该目录有写权限,rw表示对该目录有读写权限。最后一行的* =表示,除了上面设置了权限的用户组之外,其他任何人都被禁止访问本目录。这个很重要,一定要加上!
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
注意:如果修改了svn配置,需要重启svn服务,步骤如下:
# ps -aux|grep svnserve
# kill -9 ID号
# svnserve -d -r /home/svn
8,测试服务器
# svn co svn://192.168.1.77/project
Authentication realm: 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for 'root':
Authentication realm: 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: 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Password for ‘root’:
Authentication realm: 92731041-2dae-4c23-97fd-9e1ed7f0d18d
Username: pm
Password for ‘pm’:
A project/test
A project/server
A project/client
Checked out revision 1. ( 测试提取成功 )