linux环境下安装SVN服务器
想学习在LINUX下安装LINUX服务器,看这个就够了^^
操作方法
- 01
安装必要的软件包【root用户下进行】: yum install subversion; --安装svn服务器 yum install httpd; --适用WEB方式管理svn服务器 yum install mod_dav_svn; --同上 yum install mod_perl; --同上 yum install wget --一般都应该有,不需要装 yum install gcc-c++ --一般都应该有,不需要装 yum install make --一般都应该有,不需要装 yum install unzip --一般都应该有,不需要装 yum install perl* --一般都应该有,不需要装
- 02
svn服务器基本配置: 新建目录: mkdir /home/svn 新建版本仓库:svnadmin create /home/svn/project 初始化版本仓库: 建立临时目录: mkdir project project/server project/client project/test 初始化svn目录: svn import project/ file:///home/svn/project -m “初始化svn目录” 删除建立的临时目录: rm -rf project
- 03
添加用户: vi /home/svn/project/conf/passwd [users] pm = pm_pw server_group = server_pw client_group = client_pw test_group = test_pw
- 04
修改用户访问策略: vi /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 * = 以上信息表示,只有pm有根目录的读写权,server_group能访问server目录,client_group能访问client目录,所有人都可以访问doc目录
- 05
修改svnserve.conf文件,生效配置 [general] anon-access = none auth-access = write password-db = /home/svn/project/conf/passwd authz-db = /ome/svn/project/conf/authz
- 06
配置svn服务器的http支持--转换svn服务器密码: #!/usr/bin/perl use warnings; use strict; #open the svn passwd file open (FILE,"passwd") or die ("Cannot open the passwd file!!!\n"); #cleaer the apache passwd file open (OUT_FILE, ">webpasswd") or die ("Cannot open the webpasswd file!!!\n"); close (OUT_FILE); #begin foreach (<FILE>) { if($_ =~ m/^[^#].*=/) { $_ =~ s/=//; `htpasswd -b webpasswd $_`; } } 执行 ./PtoWP.pl
- 07
配置svn服务器的http支持--修改httpd.conf: vi /etc/httpd/conf/httpd.conf 在最后写入如下文件: <Location /project> DAV svn SVNPath /home/svn/project/ AuthType Basic AuthName "svn for project" AuthUserFile /home/svn/project/conf/webpasswd AuthzSVNAccessFile /home/svn/project/conf/authz Satisfy all Require valid-user </Location>
- 08
启动httpd服务: service httpd start
- 09
启动svn服务器: svnserve -d -r /home/svn
- 10
浏览器访问测试: http://192.168.107.191/project