本文共 2667 字,大约阅读时间需要 8 分钟。
CentOS 5/6下搭建Subversion+HTTPS+LDAP
准备环境
yum –y install apr apr-util apr-devel apr-util-devel zlib zlib-devel libtool
yum –y install httpd httpd-devel mod_ssl openssl openssl-devel openldap
yum remove subversion
wget
wget
注:关闭防火墙和selinux
编译subversion
tar zxvf subversion-1.7.4.tar.gz
cd subversion-1.7.4
mkdir sqlite-amalgamation
cd ..
tar zxvf sqlite-autoconf-3071000.tar.gz
cd sqlite-autoconf-3071000
cp sqlite3.c ../subversion-1.7.4/sqlite-amalgamation/
cd ../subversion-1.7.4
./configure --prefix=/usr/local/subversion-1.7.4 --with-apxs=/usr/sbin/apxs --with-ssl --with-zlib --enable-maintainer-mode
make && make install
vim /etc/profile
添加以下内容:
PATH=/usr/local/subversion-1.7.4/bin:$PATH
export LC_ALL=C
source /etc/profile
svnserve –version (显示版本说明安装成功)
svnserve, version 1.7.4 (r1295709)
compiled Apr 18 2012, 16:23:18
Copyright (C) 2012 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/
The following repository back-end (FS) modules are available:
* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
创建版本库相关目录
groupadd svn
useradd -s /sbin/nologin svn -g svn
mkdir -p /opt/test
chown -R apache:svn /opt/test
建立版本库
svnadmin create /opt/test
配置svn权限authz
vim /opt/test/conf/authz
[/]
kcguo = rw
kelton = rw
配置svn账户密码passwd
vim /opt/test/conf/passwd
[users]
kelton = 1qaz2wsxE
配置svn配置文件svnserve.conf
vim /opt/test/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
配置Apache
vim /etc/httpd/conf/httpd.conf
查找LoadModule,在末尾加入:
# for svn
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
并在配置文件最后加入:
# for svn
Include conf.d/subversion.conf
,
Apache配置文件subversion.conf
vim /etc/httpd/conf.d/subversion.conf
<Location /test>
DAV svn
SVNPath /opt/test
AuthBasicProvider ldap
AuthType Basic
AuthzLDAPAuthoritative off
AuthzSVNAccessFile /opt/test/conf/authz
AuthName "AvePoint Subversion Server"
AuthLDAPURL 此处填写LDAP配置信息
AuthLDAPBindDN "CN=*,OU=**,DC=***,DC=***"
AuthLDAPBindPassword "****"
require valid-user
SSLRequireSSL
</Location>
配置LDAP
vim /etc/openldap/ldap.conf
末尾添加 REFERRALS off
启动SVN版本库
svnserve -d --listen-port 3312 --config-file /opt/test/conf/svnserve.conf -r /opt/test/
TortoiseSVN软件:svn://IP:3312/test/ 或https://IP/test
在浏览器中输入:https://IP/test
test - Revision 0: /
version 1.7.4 (r1295709).