Building Apache HTTP Server - linux-on-ibm-z/docs GitHub Wiki
Building Apache HTTP Server
Below versions of Apache HTTP Server are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.8, 8.10) have
2.4.37
- RHEL (9.2, 9.4) have
2.4.57
- SLES 12 SP5 has
2.4.51
- SLES 15 SP5 has
2.4.51
- SLES 15 SP6 has
2.4.51
- Ubuntu 20.04 has
2.4.41
- Ubuntu 22.04 has
2.4.52
- Ubuntu 24.04 has
2.4.58
The instructions provided below specify the steps to build Apache HTTP Server version 2.4.62 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4)
- SLES (12 SP5, 15 SP5)
- Ubuntu (20.04, 22.04, 24.04)
General Notes:
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it
Step 1: Build using script
If you want to build Apache http server using manual steps, go to STEP 2.
Use the following commands to build Apache http server using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/ApacheHttpServer/2.4.62/build_apachehttpserver.sh
# Build Apache HTTP Server
bash build_apachehttpserver.sh
If the build completes successfully, go to STEP 3. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
Step 2: Build Apache HTTP Server
2.1) Install dependencies
-
RHEL (9.2, 9.4)
sudo yum install -y git openssl openssl-devel python gcc libtool autoconf make pcre pcre-devel libxml2 libxml2-devel expat-devel file which wget tar procps
-
RHEL (8.8, 8.10)
sudo yum install -y git openssl openssl-devel python2 gcc libtool autoconf make pcre pcre-devel libxml2 libxml2-devel expat-devel diffutils file which wget tar procps
-
SLES (12 SP5, 15 SP5, 15 SP6)
sudo zypper install -y git openssl libopenssl-devel python3 gcc libtool autoconf make libpcre1 pcre-devel libxml2-tools libxml2-devel libexpat-devel which wget tar awk
-
Ubuntu 20.04
sudo apt-get update sudo apt-get install -y git python openssl gcc autoconf make libtool-bin libpcre3-dev libxml2 libexpat1 libexpat1-dev wget tar
-
Ubuntu (22.04, 24.04)
sudo apt-get update sudo apt-get install -y git python3 openssl gcc autoconf2.69 make libtool-bin libpcre3-dev libxml2 libexpat1 libexpat1-dev wget tar sudo ln -s /usr/bin/python3 /usr/bin/python sudo rm -rf /usr/bin/autoconf sudo ln -s /usr/bin/autoconf2.69 /usr/bin/autoconf
2.2) Extract Apache HTTP source code (and supporting packages)
export SOURCE_ROOT=/<source_root>/
cd $SOURCE_ROOT
git clone https://github.com/apache/httpd.git
cd $SOURCE_ROOT/httpd
git checkout 2.4.62
cd $SOURCE_ROOT/httpd/srclib
git clone https://github.com/apache/apr.git
cd $SOURCE_ROOT/httpd/srclib/apr
git checkout 1.7.4
cd $SOURCE_ROOT/httpd/srclib
git clone https://github.com/apache/apr-util.git
cd $SOURCE_ROOT/httpd/srclib/apr-util
git checkout 1.6.3
2.3) Build and Install Apache HTTP Server
cd $SOURCE_ROOT/httpd
sudo alternatives --set python /usr/bin/python2 (For RHEL 8.x only)
sudo ln -s /usr/bin/python3 /usr/bin/python (For SLES 15.x only)
./buildconf
./configure --with-included-apr --prefix=<build-location>
make
sudo make install
Note: Skipping the --prefix
results in Apache httpd being installed in the default location.
Step 3: Verification(Optional)
Note: All the following commands may require sudo
depending on the <build-location>
specified.
3.1) Update your configuration as necessary
To update configuration you may modify <build-location>/conf/httpd.conf
file.
3.2) Verify the configuration and start the server
Create daemon
user for SLES 15.x only
sudo groupadd daemon
sudo useradd -G daemon daemon
Start the server
<build-location>/bin/apachectl configtest
<build-location>/bin/apachectl -k start
Note: If <build-location>
is the prefix you specified, ensure that in /conf/httpd.conf file, values for User
and Group
fields are same as that of <build-location>
. Else, it will display forbidden(403) error in the browser.
3.3) Stop the webserver
<build-location>/bin/apachectl -k stop
Note: <build-location>
is the prefix you specified, if you didn't specify a prefix it should be installed to /usr/local/apache2
.