1.安装ldap
wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
tar zxvf db-4.8.30.tar.gz
cd db-4.8.30/build_unix/
../dist/configure --prefix=/usr/local/BerkeleyDB
make && make install && cd ../../
echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf
ldconfig



wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.35.tgz

tar zxvf openldap-2.4.35.tgz
cd openldap-2.4.35
LDFLAGS="-L/usr/local/BerkeleyDB/lib/" CPPFLAGS="-I/usr/local/BerkeleyDB/include" ./configure --prefix=/usr/local/openldap --enable-static --enable-shared
make depend
make && make install && cd .



2.安装openssl

#wget http://www.openssl.org/source/openssl-1.0.1.tar.gz
# tar xzvf openssl-1.0.1.tar.gz
# cd openssl-1.0.1
# ./config -fPIC --prefix=/usr/local/openssl/ enable-shared (一定需要加上-fPIC参数,否则编译安装serf会报错)
# make && make install
3.安装http
tar zxvf httpd-2.2.24.tar.gz


安装apr:

cd httpd-2.2.24/srclib/apr/
./configure --prefix=/usr/local/apr && make && make install


安装apr-util:

cd ../apr-util/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ \
--with-berkeley-db=/usr/local/BerkeleyDB/  --with-ldap-include=/usr/local/openldap/include/ \
--with-ldap-lib=/usr/local/openldap/lib  --with-ldap  --with-openssl=/usr/local/openssl
make && make install


安装http:

cd    ../../
LDFLAGS=-ldl ./configure --prefix=/usr/local/httpd2 --with-apr=/usr/local/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apr-util/bin/apu-1-config --enable-authnz-ldap \
--enable-ldap  --enable-mods-shared=all --enable-modules=all  --enable-ssl  \

--with-ssl=/usr/local/openssl/ --enable-so --enable-dav --enable-maintainer-mode --enable-rewrite

http安装完成,启动http:/usr/lcoal/httpd2/bin/apachectl start

浏览器登录:143231281.png


4.安装svn:
wget ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install && cd ..
echo "/usr/local/libiconv/lib" >> /etc/ld.so.conf

ldconfig



tar zxvf neon-0.29.6.tar.gz
cd neon-0.29.6
yum install libxml2 libxml2-devel expat expat-devel

./configure --prefix=/usr/local/neon && make && make install && cd ..



wget http://serf.googlecode.com/files/serf-1.0.0.tar.bz2
tar jxvf serf-1.0.0.tar.bz2
cd serf-1.0.0
./configure --prefix=/usr/local/serf --with-apr-util=/usr/local/apr-util/ --with-openssl=/usr/local/openssl/

make && make install && cd ..


tar -xvf subversion-1.7.8.tar.gz
tar zxvf sqlite-amalgamation-3.7.3.tar.gz
mkdir subversion-1.7.8/sqlite-amalgamation
cp sqlite-3.7.3/sqlite3.c subversion-1.7.8/sqlite-amalgamation
cd sqlite-3.7.3
./configure --prefix=/usr/local/sqlite3
make && make install && cd ../
echo "/usr/local/sqlite3/lib" >> /etc/ld.so.conf
ldconfig


cd ../subversion-1.7.8
LD_LIBRARY_PATH=/usr/local/BerkeleyDB/lib/ \
CPPFLAGS="-I/usr/local/BerkeleyDB/include" \
LDFLAGS="-L/usr/local/BerkeleyDB/lib" \
./configure --prefix=/usr/local/svn \
--with-berkeley-db=db.h:/usr/local/BerkeleyDB/include:/usr/local/BerkeleyDB/lib:db-4.8 \
--with-apxs=/usr/local/httpd2/bin/apxs \
--with-apr=/usr/local/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apr-util/bin/apu-1-config \
--with-serf=/usr/local/serf \
--with-neon=/usr/local/neon/lib \
--with-ssl \
--with-zlib=/usr/lib \
--enable-maintainer-mode
make && make install
cd
echo 'PATH=/usr/local/svn/bin:$PATH' >> /etc/profile
echo 'export SVN_EDITOR=vim' >> /etc/profile
source /etc/profile
测试SVN安装是否成功:svn  --version

143315570.png

5.SVN通过LDAP认证,实现windwos AD中用户登录:

(1)SVN版本库创建:

建立svn版本库存放的根目录:mkdir  -p /opt/svndata/

建立svn版本库test:svnadmin create /opt/svndata/test

赋予权限:chown -R daemon:daemon /opt/svndata/test  //daemon用户和组是http配置文件中默认的,用来通过http登录svn,可以根据需要进行修改。

启动svn服务:
svnserver -d -r /opt/svndata  

netstat -nltp |grep 3690  //svn默认启动端口

(2

vim  /usr/local/openldap/etc/openldap/ldap.conf

添加  REFERRALS off

echo "LoadModule dav_svn_module     modules/mod_dav_svn.so" >> /usr/local/httpd2/conf/httpd.conf
echo "LoadModule authz_svn_module modules/mod_authz_svn.so" >> /uar/lcoal/httpd2/conf/httpd.conf
vim /usr/local/httpd/conf/httpd.conf
将Include conf/extra/httpd-vhosts.conf前的#注释掉


添加虚拟主机

vim  /usr/local/httpd/conf/extra/httpd-vhosts.conf
143734179.png

6.SVN测试:

添加登录用户,并设置权限,vim /opt/svndata/authz

143848452.png


SVN客户端测试:http://192.168.0.223/svndata/test

143919580.png

浏览器登录:

144009655.png

点击登录即可,出现如下说明登录成功:

144104615.png