####1.添加源

[wandiscoSVN]
name=Wandisco SVN Repo
baseurl=http://opensource.wandisco.com/centos/6/svn-1.8/RPMS/$basearch/
enabled=1
gpgcheck=0

2.安装

yum install subversion httpd mod_dav_svn php php-mysql php-gd php-xml php-fpm -y

####3.修改配置

/etc/httpd/conf.d/subversion.conf

# cat /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
LoadModule dontdothat_module  modules/mod_dontdothat.so

Alias /usvn /data/usvn/public
<Directory "/data/usvn/public">
    Options +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

4.下载usvn代码

wget https://github.com/usvn/usvn/archive/1.0.7.zip

解压到 /data/usvn 目录下

chown 48.48 /data/usvn -R

Web ui : http://127.0.0.1/install.php 进行安装

5.错误处理

5.1 数据库sql报错

替换掉/data/usvn/library/SQL/mysql.sql 内容为如下

create table usvn_files_rights
(
   files_rights_id                int                            not null AUTO_INCREMENT,
   projects_id                    int                            not null,
   files_rights_path            text,
   primary key (files_rights_id)
)
ENGINE=InnoDB;

create index to_belong_fk on usvn_files_rights
(
   projects_id
);

create table usvn_groups
(
   groups_id                      int                            not null AUTO_INCREMENT,
   groups_name                    varchar(150)                   not null,
   groups_description             varchar(1000),
   CONSTRAINT GROUPS_NAME_UNQ UNIQUE (groups_name),
   primary key (groups_id)
)
ENGINE=InnoDB;

create table usvn_groups_to_files_rights
(
   files_rights_id                int                            not null,
   groups_id                      int                            not null,
   files_rights_is_readable       bool                                  not null,
   files_rights_is_writable       bool                                  not null,
   primary key (files_rights_id, groups_id)
)
ENGINE=InnoDB;

create index usvn_groups_to_files_rights_fk on usvn_groups_to_files_rights
(
   files_rights_id
);

create index usvn_groups_to_files_rights2_fk on usvn_groups_to_files_rights
(
   groups_id
);

create table usvn_groups_to_projects
(
   projects_id                    int                            not null,
   groups_id                      int                            not null,
   primary key (projects_id, groups_id)
)
ENGINE=InnoDB;

create index usvn_groups_to_projects_fk on usvn_groups_to_projects
(
   projects_id
);

create index usvn_groups_to_projects2_fk on usvn_groups_to_projects
(
   groups_id
);

create table usvn_projects
(
   projects_id                    int                            not null AUTO_INCREMENT,
   projects_name                  varchar(255)                   not null,
   projects_start_date            datetime                       not null,
   projects_description           varchar(1000),
   CONSTRAINT PROJECTS_NAME_UNQ UNIQUE (projects_name),
   primary key (projects_id)
)
ENGINE=InnoDB;

create table usvn_users
(
   users_id                       int                            not null AUTO_INCREMENT,
   users_login                    varchar(255)                   not null,
   users_password                 varchar(64)                    not null,
   users_lastname                 varchar(100),
   users_firstname                varchar(100),
   users_email                    varchar(150),
   users_is_admin                 bool                                          not null,
   users_secret_id                varchar(32)                   not null,
   CONSTRAINT USERS_LOGIN_UNQ UNIQUE (users_login),
   primary key (users_id)
)
ENGINE=InnoDB;

create table usvn_users_to_groups
(
   users_id                       int                            not null,
   groups_id                      int                            not null,
   is_leader                                  bool                                                      not null,
   primary key (users_id, groups_id)
)
ENGINE=InnoDB;

create index usvn_users_to_groups_fk on usvn_users_to_groups
(
   users_id
);

create index usvn_users_to_groups2_fk on usvn_users_to_groups
(
   groups_id
);

create table usvn_users_to_projects
(
   projects_id                    int                            not null,
   users_id                       int                            not null,
   primary key (projects_id, users_id)
)
ENGINE=InnoDB;

create index usvn_users_to_projects_fk on usvn_users_to_projects
(
   projects_id
);

create index usvn_users_to_projects2_fk on usvn_users_to_projects
(
   users_id
);

alter table usvn_files_rights add constraint fk_usvn_file_rights foreign key (projects_id)
      references usvn_projects (projects_id) on delete restrict on update restrict;

alter table usvn_groups_to_files_rights add constraint fk_usvn_groups_to_files_rights foreign key (files_rights_id)
      references usvn_files_rights (files_rights_id) on delete restrict on update restrict;

alter table usvn_groups_to_files_rights add constraint fk_usvn_groups_to_files_rights2 foreign key (groups_id)
      references usvn_groups (groups_id) on delete restrict on update restrict;

alter table usvn_groups_to_projects add constraint fk_usvn_groups_to_projects foreign key (projects_id)
      references usvn_projects (projects_id) on delete restrict on update restrict;

alter table usvn_groups_to_projects add constraint fk_usvn_groups_to_projects2 foreign key (groups_id)
      references usvn_groups (groups_id) on delete restrict on update restrict;

alter table usvn_users_to_groups add constraint fk_usvn_users_to_groups foreign key (users_id)
      references usvn_users (users_id) on delete restrict on update restrict;

alter table usvn_users_to_groups add constraint fk_usvn_users_to_groups2 foreign key (groups_id)
      references usvn_groups (groups_id) on delete restrict on update restrict;

alter table usvn_users_to_projects add constraint fk_usvn_users_to_projects foreign key (projects_id)
      references usvn_projects (projects_id) on delete restrict on update restrict;

alter table usvn_users_to_projects add constraint fk_usvn_users_to_projects2 foreign key (users_id)
      references usvn_users (users_id) on delete restrict on update restrict;

#ALTER TABLE `usvn_groups` CHANGE `groups_id` `groups_id` INT( 11 ) NOT NULL AUTO_INCREMENT ;
#ALTER TABLE `usvn_projects` CHANGE `projects_id` `projects_id` INT( 11 ) NOT NULL AUTO_INCREMENT ;
#ALTER TABLE `usvn_users` CHANGE `users_id` `users_id` INT( 11 ) NOT NULL AUTO_INCREMENT ;
#ALTER TABLE `usvn_files_rights` CHANGE `files_rights_id` `files_rights_id` INT( 11 ) NOT NULL AUTO_INCREMENT ;
5.2 提交svn500错误
vim /data/usvn/public/.htaccess 
8行添加
RewriteRule ^svn/ - [L,NC] 

6.配置使用LDAP认证

/etc/httpd/conf.d/subversion.conf 添加 之间配置

<Location /usvn/svn/>
        ErrorDocument 404 default
        DAV svn
        Require valid-user
        SVNParentPath /data/usvn/files/svn
        SVNListParentPath off
        AuthType Basic
        AuthName "USVN"
        ** AuthBasicProvider ldap **
        ** AuthLDAPURL "ldap://10.110.3.2/ou=People,dc=xx,dc=cn?uid" **
        ** AuthLDAPBindDN "cn=Manager,dc=xx,dc=cn" **
        ** AuthLDAPBindPassword "f8no?<7S;LL[lSeZ" **
        AuthUserFile /data/usvn/files/htpasswd
        AuthzSVNAccessFile /data/usvn/files/authz
</Location>

usvn 配置
Usvn 安装