-
-
Save dalmosantos/f704e150d246f4eb3c9a8f597cad7eb6 to your computer and use it in GitHub Desktop.
Compile Apache 2.2 from source on Centos 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################### | |
Apache Installation | |
############################################################### | |
# Install required tools for compilation | |
sudo yum install autoconf expat-devel libtool libnghttp2-devel apr apr-util pcre-devel openssl-devel zlib-devel -y | |
# Download source code | |
cd /usr/local/src | |
curl -O -L https://github.com/apache/httpd/archive/2.2.34.tar.gz #latest stable release Apache 2.2 | |
curl -O -L https://github.com/apache/apr/archive/1.7.0.tar.gz #Apache Runtime library. Required for Apache HTTPD | |
curl -O -L https://github.com/apache/apr-util/archive/1.6.1.tar.gz #Apache Runtime library. Required for Apache HTTPD | |
# Unpack downloaded sources | |
tar -zxvf 2.2.34.tar.gz | |
tar -zxvf 1.7.0.tar.gz | |
tar -zxvf 1.6.1.tar.gz | |
# Apache requires APR library for compilation. Copy the source codes to correct directory | |
# It's important to not to include version number in APR directories. | |
# If you just copy apr-1.7.0 without changing the name, it will give you a warning about missing apr directory. | |
cp -r apr-1.7.0 httpd-2.2.34/srclib/apr | |
cp -r apr-util-1.6.1 httpd-2.2.34/srclib/apr-util | |
# compile apache (avoid running package compiling as root or sudo ) | |
cd httpd-2.2.34 # change dir to downloaded apache source | |
./buildconf | |
./configure \ | |
--prefix=/etc/httpd \ | |
--exec-prefix=/etc/httpd \ | |
--bindir=/usr/bin \ | |
--sbindir=/usr/sbin \ | |
--mandir=/usr/share/man \ | |
--libdir=/usr/lib64 \ | |
--sysconfdir=/etc/httpd/conf \ | |
--includedir=/usr/include/apache/httpd \ | |
--libexecdir=/usr/lib64/httpd/modules \ | |
--datadir=/var/lib/apache \ | |
--enable-mpms-shared=all \ | |
--enable-suexec --with-suexec \ | |
--enable-suexec-capabilities \ | |
--with-suexec-caller=apache \ | |
--with-suexec-docroot=/var/www \ | |
--without-suexec-logfile \ | |
--with-suexec-syslog \ | |
--with-suexec-bin=/usr/sbin/suexec \ | |
--with-suexec-uidmin=500 --with-suexec-gidmin=100 \ | |
--enable-pie \ | |
--with-pcre \ | |
--with-inluded-apr \ | |
--enable-mods-shared=all \ | |
--enable-ssl \ | |
--with-ssl=/usr/local/openssl \ | |
--disable-distcache \ | |
--enable-proxy \ | |
--enable-cache \ | |
--enable-disk-cache \ | |
--enable-cgid \ | |
--enable-cgi \ | |
--enable-authn-anon \ | |
--enable-authn-alias \ | |
--enable-deflate \ | |
--disable-imagemap | |
make | |
# After compiling install HTTPD with sudo | |
sudo make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment