These days have been building svn, online search for a lot of information, no one is complete, so I have to organize a copy of the installation manual, recorded, the first is to make a note to yourself, the second is to give you a reference.
The following is a simple directory description:
Subversion Directory Description:
*dav directory: is to provide Apache and MOD_DAV_SVN use of the directory, let them store internal data
*db Directory: All version-controlled data storage files
*hooks directory: The directory where the hook script files are placed
*locks directory: Used to place subversion to see the hard lock data of the directory, used to track access to the vault client
*format file: is a text file with only an integer in it. Represents the version number of the current vault configuration
*conf Directory: Is the configuration file of this warehouse (user access account, permissions, etc.) of the Warehouse
System environment
CentOS 6.5 Desktop Installation form (off Iptables and SELinux)
One, install the necessary packages.
yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced
Description
Subversion (SVN server)
Mysql-server (for Codestriker)
httpd mod_dav_svn mod_perl (for Web-enabled management of SVN servers)
SendMail (used to configure user-submitted code to send email reminders)
wget gcc-c++ make unzip perl* (prerequisite package)
NTSYSV vim-enhanced (optional)
Two, the basic SVN server configuration
1, create a new directory to store all SVN files
# MKDIR/HOME/SVN
2, create a new version of the warehouse
# svnadmin Create/home/svn/project
3, initialize the directory in the version repository
# mkdir Project Project/server project/client project/test (Create temp directory)
# SVN import project/file:///home/svn/project-m "Initialize SVN directory"
# RM-RF Project (delete the temporarily created directory)
4, add user
To add SVN users is very simple, just add a "Username=password" entry in the/home/svn/project/conf/passwd file. For testing, I added the following:
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
admin = 123456
huangyunping = 123456
hekaining = 123456
Shunfeng = 123456
Zhushengnan = 123456
Gaozhe = 123456
Luwenjun = 123456
Fangwei = 123456
Yefuhua = 123456
Wangwei = 123456
Chenwei = 123456
Explanation: The above is the creation of user accounts, regardless of the above account is which group, as long as the landing must be built in this place, grouping is in
Authz file under control. Above the admin account, I am building a high-privileged account. Name = password
5. Modify the user access policy
/home/svn/project/conf/authz record the user's access policy, this place I struggled for a few days, because the access directory is different, but you will understand after the understanding. There are many # comments out of the fee code, can not see, I directly paste a useful script here. Here are the references:
[Aliases]
# Joe =/c=xz/st=dessert/l=snake City/o=snake oil, ltd./ou=research Institute/cn=joe Average
#组的访问权限
[Groups]
Project_admin = Admin,wangwei
PROJECT_UI = huangyunping
Project_app = hekaining
Project_web = Shunfeng,zhushengnan
PROJECT_JG = Liuyuntao
Project_yj = Gaozhe,luwenjun
Project_test = Fangwei,yefuhua
Project_products =chenwei
#各组的访问路径
[project:/]
@project_admin = RW
* =
[Project:/ui]
@project_ui = RW
@project_admin = RW
* =
[Project:/app]
@project_app = RW
@project_admin = RW
* =
[Project:/web]
@project_web = RW
@project_admin = RW
* =
[Project:/jiagou]
@project_jg = RW
@project_admin = RW
* =
[Project:/yingjian]
@project_yj = RW
@project_admin = RW
* =
[Project:/test]
@project_test = RW
@project_admin = RW
* =
[Project:/products]
@project_products = RW
@project_admin = RW
* =
Description
New group name = Team member, is passwd inside the new account, up and down there are two parts, the upper part is a group, the next part is to set the access path of the group.
[Project name,/folder accessed by this group]
RW is a read-write permission, R is ReadOnly, and the last line of each group * = indicates that everyone else is forbidden to access this directory in addition to the user group with the permissions set above. This is very important, be sure to add!
[general]
anon-access = None
auth-access = write
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
(前几天遇到这个的一个错误,我新建两个项目,启动的时候是启动到下面一个项目路径,造成上一级项目的路径账号下的人员登录不上,最后原因是启动的目录一定要是上级目录,就是svn目录,svn下面的项目目录如果单独启动的话就会出问题,如果是两个以上的情况下。)
8,测试服务器
用svn客户端可以尝试测试,访问目录是:svn://192.168.8.18/project 账号可以用上面的admin 123456,确保访问的权限路径文件夹要有。如我的,看:
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/5B/8C/wKiom1ULjTPR-cD1AAI9giE5GfM695.jpg" title="QQ20150320105834.jpg" alt="wKiom1ULjTPR-cD1AAI9giE5GfM695.jpg" />
至此,文件传输已经完成!
但是有的需要用http访问,可以继续这样操作
Third, configure HTTP support for SVN server
1, convert SVN server's password
Because the password for the SVN server is plaintext, the HTTP server is not supported, so it needs to be converted to the HTTP supported format. I wrote a perl script to finish the job.
The script reads as follows:
# cd/home/svn/project/conf/
# Vim ptowp.pl
#!/usr/bin/perl
# Write by Huabo, 2009-11-20
Use warnings;
Use strict;
#open the SVN passwd file
Open (file, "passwd") or Die ("Cannot open the passwd FILE!!! n ");
#clear 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 $_ ';
}
}
# chmod +x ptowp.pl
#./ptowp.pl
Adding Password for user pm
Adding Password for user Server_group
Adding Password for user Client_group
Adding Password for user Test_group
Now there will be one more webpasswd file in the directory.
2, modify httpd.conf, add content about SVN server
To edit/etc/httpd/conf/httpd.conf, add the following information at the end:
<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>
3, modify the owner of the SVN directory to Apache account: Chown-r apache.apache/home/svn/project/
(Note: This step is missing from the original, which gives permission issues.) )
4. Restart the Web server:
#/etc/init.d/httpd Restart
stopping httpd: [FAILED]
Starting httpd: [OK]
5, Access http://192.168.8.18/project/with a browser
The test results are as follows:
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/5B/8C/wKiom1ULjefwxLCTAAG6j1-Yen4335.jpg" title="23.jpg" alt="wKiom1ULjefwxLCTAAG6j1-Yen4335.jpg" />
注意:这个地方输入账号密码会报错,解决方法我还在寻找找,估计是svn密码在http中不能识别,有高手的可以帮我解决下,谢谢!
This article is from "Ghost" blog, please make sure to keep this source http://fangwei009.blog.51cto.com/5234706/1622481
Installing the SVN method under Linux centos6.5