源码编译安装Apache httpd 2.4.41
安装环境:centos7.8 + httpd2.4.41 + apr-1.7.0 + apr-util-1.6.1 + pcre-8.43
基础环境安装
yum -y install openssl-devel bzip2
1、下载编译apr1.7.0
下载地址:http://www.linuxfromscratch.org/blfs/view/svn/general/apr.html
$ wget https://archive.apache.org/dist/apr/apr-1.7.0.tar.bz2
$ tar -xvf apr-1.7.0.tar.bz2
$ cd apr-1.7.0/
$ ./configure --prefix=/opt/apr
$ make
$ make install
注:arm系统使用apr1.6.5
2、下载编译apr-util
下载地址:https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.bz2
$ tar -xvf apr-util-1.6.1.tar.bz2
$ cd apr-util-1.6.1/
$ ./configure --prefix=/opt/apr-util --with-apr=/opt/apr
$ make
$ make install
编译apr-util需要指定:--with-apr
注:在x86平台上可以使用最新的apr-util版本,因为在移植到arm平台的时候,使用较新的版本总是编译不过,所以使用apr-util-1.5.4这个版本
3、下载编译pcre8.43
下载地址:https://sourceforge.net/projects/pcre/files/pcre/8.43/
$ unzip pcre-8.43.zip
$ ./configure --prefix=/opt/pcre
$ make
$ make install
4、源码编译Apache httpd
Apache httpd源码地址下载:http://archive.apache.org/dist/httpd/,搜索2.4.41版本
$ tar -xvf httpd-2.4.41.tar.gz
$ cd httpd-2.4.41/
$ ./configure --prefix=/usr/local/httpd2.4.41 --with-pcre=/opt/pcre --with-apr=/opt/apr --with-apr-util=/opt/apr-util
$ make
$ make install
注:ARM编译使用/configure --prefix=/usr/local/apache2 --host=x86 --enable-cgi --enable-rewrite --enable-mods-shared=all --with-pcre=/usr/local/pcre --with-includer-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
5、验证关闭
[root@baidu1 bin]# ./apachectl
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe45:4e96%ens33. Set the 'ServerName' directive globally to suppress this message
[root@baidu1 bin]# ps -ef |grep httpd
root 7892 1 0 14:52 ? 00:00:00 /usr/local/httpd2.4.41/bin/httpd
daemon 7893 7892 0 14:52 ? 00:00:00 /usr/local/httpd2.4.41/bin/httpd
daemon 7894 7892 0 14:52 ? 00:00:00 /usr/local/httpd2.4.41/bin/httpd
daemon 7895 7892 0 14:52 ? 00:00:00 /usr/local/httpd2.4.41/bin/httpd
root 7978 5594 0 14:52 pts/4 00:00:00 grep --color=auto httpd
#关闭
[root@baidu1 bin]# killall httpd
搞定。