1.安装依赖包及下载软件包
1.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
1.2下载软件包
apr-1.6.5 http://mirrors.cnnic.cn/apache/apr/apr-1.6.5.tar.gz
apr-util-1.6.1 https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
pcre-8.42 https://jaist.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.bz2
zlib-1.2.11 http://www.zlib.net/fossils/zlib-1.2.11.tar.gz
serf-1.3.9 http://www.apache.org/dist/serf/serf-1.3.9.tar.bz2
sqlite-autoconf-3280000 https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz
sqlite-amalgamation-3240000 https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip
openssl-1.2.0 yum安装
httpd-2.4.38 http://www.apache.org/dist/httpd/httpd-2.4.38.tar.gz --之前的博客有安装方法,此次不在讲解
subversion-1.12.0 http://www.apache.org/dist/subversion/subversion-1.12.0.tar.gz
1.3解压安装
1>安装apr-1.6.5以及apr-util-1.6.1
tar -zxvf apr-1.6.5.tar.gz -C /app/software/src
tar -zxvf apr-util-1.6.1.tar.gz -C /app/software/src
cd app/src/
ll
cd apr-1.6.5/
./configure --prefix=/app/apr-1.6.5
make
make install
cd apr-util-1.6.1
./configure --prefix=/app/apr-util-1.6.1 --with-apr=/app/apr-1.6.5/bin/apr-1-config
make #编译
make install #安装
2>安装pcre-8.42
tar xjpf pcre-8.42.tar.bz2 -C /app/software/src
cd pcre-8.42
./configure --prefix=/app/pcre-8.42
3>安装zlib-1.2.11
tar -zxvf zlib-1.2.11.tar.gz -C /app/software/src
cd zlib-1.2.11
./configure --prefix=/app/zlib-1.2.11
make
make install
4>安装serf-1.3.9
tar xjpf serf-1.3.9.tar.bz2 -C /app/software/src
tar -jxvf serf-1.3.9.tar.bz2
cd serf-1.3.9
yum install scons
scons --prefix=/app/serf-1.3.9 apr=/app/apr-1.6.5/bin/apr-1-config apu=/app/apr-util-1.6.1/bin/apu-1-config ##根据具体安装目录而定
scons install
5>安装sqlite-autoconf-3280000
tar -zxvf sqlite-autoconf-3280000.tar.gz -C /app/software/src
cd sqlite-autoconf-3280000
./configure --prefix=/app/sqlite-autoconf-3280000 --enable-libtool-lock
make
make install
6>安装svn-1.12
tar -zxvf subversion-1.12.0.tar.gz -C /app/software/src
unzip -o -d /app/software/src/sqlite-amalgamation-3240000 sqlite-amalgamation-3240000.zip
mv sqlite-amalgamation-3240000 subversion-1.12.0/sqlite-amalgamation
./configure --prefix=/app/svn-1.12 --with-apr=/app/apr-1.6.5/ --with-apr-util=/app/apr-util-1.6.1/ --with-apxs=/app/apache-2.4.38/bin/apxs --with-apache-libexecdir --with-sqlite=/app/sqlite-autoconf-3280000/ --with-openssl=/usr/bin/openssl --enable-maintainer-mode --with-serf=/app/serf-1.3.9 --with-zlib=/app/zlib-1.2.11 --with-lz4=internal --with-utf8proc=internal
make
make install
2.配置(环境变量)apache和svn
vi /etc/profile
#配置环境变量
PATH=$PATH:/app/apache-2.4.38/bin:/app/svn-1.12/bin
source /etc/profile
svn --version
报错,提示 libserf-1.so 找不到
./svn: error while loading shared libraries: libserf-1.so.1: cannot open shared object file: No such file or directory
显然是由于安装的 serf 库文件未被找到,可以通过以下办法解决:
# 在系统 ld.so.conf.d 目录下新建conf文件
# vi /etc/ld.so.conf.d/serf-1.3.4.conf
# 添加serf的库目录路径 /usr/local/serf/lib
# 保存退出
# /sbin/ldconfig -v
3.https访问
1.安装ssl模块
为了使Apache支持https访问,系统需要安有apache、openssl、mod_ssl.so
Linux系统默认安装了openssl,所有就不需要安装了。
查看apache是否包含了ssl模块
ls -l /app/httpd-2.4.38/modules | grep ssl
此次安装的apache中已包含了ssl模块,无需安装。如没有ssl模块,请参照以下链接进行安装。
https://blog.51cto.com/longlei/2120718
2.生成秘钥与证书
mkdir -p /app/apache-2.4.38/httpd/ssl #证书存放路径
cd /app/apache-2.4.38/httpd/ssl
openssl genrsa -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 3650 -in /app/apache-2.4.38/httpd/ssl/server.csr -signkey /app/apache-2.4.38/httpd/ssl/server.key -out server.crt
1.修改httpd-ssl.conf文件指定相关秘钥和证书位置
vi /app/apache-2.4.38/httpd/extra/httpd-ssl.conf
2.修改Apache主配置文件并开启相关模块
vi /app/apache-2.4.38/httpd/httpd.conf
#打开相关的注释,启用需要的模块
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#修改主机名
ServerName svn.i.sinotrans.com
下面的需要添加进来
RewriteEngine on
RewriteCond %{HTTPS} !=on [OR]
#RewriteCond %{SERVER_PORT} 80
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R]
3.重启apache
httpd -k restart
4.参考文献
https://www.cnblogs.com/jonnter/p/7725210.html
https://blog.csdn.net/szchenchao/article/details/83011962
https://blog.51cto.com/longlei/2120718
https://www.gworg.com/ssl/130.html
https://www.cnblogs.com/whybxy/p/8939897.html
https://blog.csdn.net/ec06cumt/article/details/61423259
https://www.cnblogs.com/hackem/p/3619415.html
https://blog.csdn.net/yuanyk1222/article/details/84256727
https://blog.csdn.net/u011781521/article/details/80200583
https://www.cnblogs.com/amu66/p/10168446.html
https://www.cnblogs.com/-mrl/p/8980244.html
https://blog.csdn.net/zcyygyl/article/details/81413410