注:需要软件包可以加入QQ群下载(144486234)
一、安装依赖包及下载软件包
1、安装
yum
-y install make openldap-devel ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf bzip2-devel ncurses-devel openssl-devel libtool* zlib-devel libxml2-devel libjpeg-devel libpng-devel libtiff-devel fontconfig-devel freetype-devel libXpm-devel gettext-devel
curl-devel curl pam-devel openldap-devel e2fsprogs-devel krb5-devel libidn libidn-devel libtool-ltdl libtidy-devel libtidy
2、下载
3、解压安装(自行解压,不备命令了,习惯将文件下载到/usr/local/src/)
cd /usr/local/src
cd apr-1.5.2
./configure --prefix=/usr/local/apr && make && make install
cd ../apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
cd ../openssl-1.0.1t
./config --prefix=/usr/local/openssl && make && make install
cd ../pcre-8.37
./configure --prefix=/usr/local/pcre && make && make install
cd ../zlib-1.2.8
./configure --prefix=/usr/local/zlib && make && make install
cd ../serf-1.2.1
yum install expat-devel
./configure --prefix=/usr/local/serf --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util && make && make install
cd ../sqlite-autoconf-3170000
./configure --prefix=/usr/local/sqlite --enable-libtool-lock && make && make install
cd ../httpd-2.4.23
./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-proxy --enable-proxy-ajp=share --enable-dav --enable-dav-fs --with-apr=/usr/local/apr/
--with-apr-util=/usr/local/apr-util/ --with-ssl=/usr/local/ssl --enable-mods-shared=all --with-zlib --enable-deflate=shared --with-pcre=/usr/local/pcre --enable-maintainer-mode --enable-proxy-fcgi --enable-modules=most --enable-mpms-shared=all --with-mpm=event
&& make && make install
cd
/usr/local/src/
mv sqlite-amalgamation-3090200 subversion-1.8.14/sqlite-amalgamation
cd subversion-1.8.14
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-apxs=/usr/local/apache/bin/apxs --with-apache-libexecdir --with-sqlite=/usr/local/sqlite/
--with-openssl --enable-maintainer-mode --with-serf=/usr/local/serf --with-zlib && make && make install
二、配置(环境变量)apache和svn
1、添加命令到环境变量,使用方便
vim /etc/profile
PATH=$PATH:/usr/local/apache/bin:/usr/local/svn/bin
source /etc/profile
2、创建版本库
目录:/data
mkdir /data/subversion $$ svnadmin create repos (尽量这样创建,后期方便扩展多个版本库)
cd /data/subversion && cp/data/subversion/repos/conf/authz /data/subversion
3、配置svn权限,添加用户
vim /data/subversion/repos/conf/authz
[groups]
root = gongjiadong
[/]
@root = rw
* = r
[repos:/]
@root = rw
* = r
[/]
@root = rw
* = r
[repos:/]
@root = rw
* = r
3.1添加用户
cd /data/subversion && htpasswd -c password [用户名] 回车之后输入两次密码即可
4、配置apache,添加秘钥对
4.1、配置apache,添加对svn模块
vim /usr/local/apache/conf/httpd.conf
添加如下两行
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
修改用户组
User apache
Group apache
取消注释
Include conf/extra/httpd-ssl.conf
4.2生成key(回车之后根据提示输入密码,两次输入的要相同)key文件统一放到/usr/local/apache/conf/ssl目录下mkdir /usr/local/apache/conf/ssl && cd/usr/local/apache/conf/ssl
openssl genrsa -des3 2048 -new > server.key
openssl req -new > server.csr
openssl rsa -in privkey.pem -out server.key
openssl req -x509 -days 36500 -key server.key -in server.csr > server.crt
4.3、编辑httpd-ssl.conf,添加svn虚拟主机
vim /usr/local/apache/conf/extra/httpd-ssl.conf
添加内容
<Location /svn/>
DAV svn
SVNParentPath /home/svn
AuthzSVNAccessFile /home/svn/authz
SVNListParentPath on
AuthType Basic
AuthName "Subversion Auth"
AuthUserFile /home/svn/password
Require valid-user
</Location>
修改内容
SSLCertificateFile "/usr/local/apache/conf/ssl/server.crt"
SSLCertificateKeyFile "/usr/local/apache/conf/ssl/server.key"
三、启动apache,通过浏览器查看版本库
/usr/local/apache/httpd -k start
报错:
(1)AH00534: httpd: Configuration error: More than one MPM loaded.
vim /usr/local/apache/conf/httpd.conf
注释这两行
#LoadModule mpm_event_module modules/mod_mpm_event.so
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
(2)AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
vim /usr/local/apache/conf/httpd.conf
取消注释
ServerName
www.example.com:80
启动之后,打开浏览器输入(https://IP/svn)输入账户密码