不言不语

您现在的位置是: 首页 >  Linux

Linux

linux之apache下载以及httpd的安装

2022-03-16Linux
linux之apache下载以及httpd的安装以及常见报错信息!

apache安装需要3个软件


apr   wget   https://downloads.apache.org/apr/apr-1.6.5.tar.gz


apr-util     wget  https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz


apache     wget     http://archive.apache.org/dist/httpd/httpd-2.4.29.tar.gz



开始安装httpd


tar xf  httpd-2.4.32.tar.gz解压


[root@localhost apache]# cd httpd-2.4.32/


编译


./configure --prefix=/usr/local/httpd  --sysconfdir=/usr/local/httpd/etc/ --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util


报错


image.png


[root@localhost httpd-2.4.32]# yum install pcre-devel  -y


报错ssl


image.png


yum install pcre-devel  openssl-devel -y 


make && make install


image.png


安装成功


如果apapche安装:collect2: error: ld returned 1报错


报错信息如下

collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.34/support”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.34/support”
make: *** [all-recursive] 错误 1

注释:错误为apr  apr-util缺失,需要把apr目录及apr-util目录拷贝到httpd的目录下:如下:

[root@localhost httpd-2.4.29]# cp -r apr-1.6.1      /usr/local/src/httpd-2.4.34/srclib/apr

[root@localhost httpd-2.4.29]# cp -r apr-util-1.6.1    /usr/local/src/httpd-2.4.34/srclib/apr-util

如若还是不行,就添加一个编译参数:--with-included-apr

再次make   &&  make    install即可::

或者有时需要重新编译即可

image.png

文章评论