SoFunction
Updated on 2025-03-10

ubuntu16.04 tutorial on linux compilation and installation of apache2.4.33

Download the package:

wget /apache//httpd/httpd-2.4.
wget /apache//apr/apr-1.6.
wget /apache//apr/apr-util-1.6.

First, you need to install apr and apr-util

tar xf apr-1.6. 
cd apr-1.6.3/
./configure
sudo make
sudo make install

Install apr-util:

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
sudo make
sudo make install

These two are essential. If you lack other dependencies, please Baidu on your own

If you install apr-util, an error will be reported during compilation:

xml/apr_xml.c:35:19: fatal error: : No such file or directory

Solution:

sudo apt-get install libexpat1-dev

There are other dependencies:

1,pcre

sudo apt-get install libpcre3 libpcre3-dev 

2,openssl

sudo apt-get install openssl libssl-dev 

3,zlib

sudo apt-get install zlib1g-dev

Compile apache

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

Finally make makeinstall

root@dev:~# /usr/local/httpd24/bin/apachectl start
root@dev:~# ps -ef | grep httpd
root   24411 17534 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k start
daemon  24412 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k start
daemon  24413 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k start
daemon  24414 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k start
daemon  24415 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k start
daemon  24416 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k start
root   24418 24367 0 06:15 pts/19  00:00:00 grep --color=auto httpd

Modify the configuration file ( vim /etc/httpd24/ )

ServerName 127.0.0.1

DocumentRoot Specify a website root directory later

Summarize

The above is a detailed explanation of the tutorial on compiling and installing apache2.4.33 of ubuntu16.04 linux introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support for my website!