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
注:關閉防火牆和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
并在配置檔案最後加入:
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>
<a></a>
配置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: /
本文轉自 安安安安森 51CTO部落格,原文連結:http://blog.51cto.com/smallc/1230680,如需轉載請自行聯系原作者