boxmoe_header_banner_img

欢迎来到YaeMiko小站

加载中

文章导读

Apache——编译安装


avatar
Samele 2022-05-28 62

1、安装依赖
yum install  gcc gcc-c++ make zlib zlib-devel pcre pcre-devel
yum install libxml2-devel
yum install openssl openssl-devel
yum install bzip2 bzip2-devel curl-devel
yum install libjpeg-devel
yum install libpng libpng-devel
yum install freetype-devel  libxslt-devel
yum install libzip-devel
yum install libxml2-devel
yum install autoconf automake libtool
yum install sqlite-devel
yum install expat-devel
git clone https://github.com/kkos/oniguruma
cd oniguruma
./autogen.sh
./configure –prefix=/usr/local/onigurema –libdir=/lib64
make && make install

2、下载apr-1.7.0
cd /opt
wget https://dlcdn.apache.org//apr/apr-1.7.0.tar.gz
tar -zxvf /opt/apr-1.7.0.tar.gz
make -p /usr/local/apr
cd /opt/apr-1.7.0
./configure –prefix=/usr/local/apr
make && make install

编译时报错
rm: cannot remove ‘libtoolT’: No such file or directory

编辑configure
$RM “$cfgfile” 将其注释即可

3、下载apr-util-1.6.1
wget https://dlcdn.apache.org//apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
make && make install

4.下载pcre
wget https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz
cd pcre2-10.39
make -p /usr/local/pcre
./configure –prefix=/usr/local/pcre
make && make install

#也可以去pcre官网下载pcre.org

5、下载apache包

wget https://dlcdn.apache.org/httpd/httpd-2.4.53.tar.gz
cd httpd-2.4.53
mkdir -p /usr/local/httpd
./configure –prefix=/usr/local/httpd/ –enable-shared=max –enable-module=rewrite –enable-module=so –with-apr=/usr/local/apr/ –with-apr-util=/usr/local/apr-util/ –with-pcre=/usr/local/pcre/bin/pcre2-config
make && make install

#如果报错:pcre2-config找不到,他的位置可能有变化,建议用find查一下再填写。
#执行make命令报错
libtool: error: cannot find the library ‘/usr/local/apr-util//lib/libapr-1.la’ or unhandled argument ‘/usr/local/apr-util//lib/libapr-1.la’

参考:
报错原因:
apr-util 需要依赖apr,在apr-util的lib目录下的la文件中将对apr库的依赖路径修改一下

解决办法:

apr的安装路径为/usr/local/apr/,所以编辑该文件下的库文件

vi /usr/local/apr/lib/libapr-1.la找到最后一行,修改原路径

libdir=’/application/apache2.4.41/lib’为libdir=’/usr/local/apr/lib’后保存退出即可

 



评论(已关闭)

评论已关闭