Building Apache httpd from source


In case you don't have sudo access and want to install httpd, you can do it by compiling it from source. You would need to first resolve the dependencies

 Apache httpd depends on

1. Apache APR
2. Perl PCRE

Download source for

1. httpd - https://httpd.apache.org
2. apr and apr-util - https://apr.apache.org
3. pcre - https://www.pcre.org

apr-utils depends on libexpat
download libexpat source - https://libexpat.github.io/

Steps:

Note: I am installing httpd in a temp directory, you may want to install it in a different directory

1. Extract apr

gunzip apr-1.7.5.tar.gz
ls apr-1.7.5
tar xvf apr-1.7.5.tar

2. Extract apr-util

gunzip apr-util-1.6.3.tar.gz | tar zxvf
tar xvf apr-util-1.6.3.tar
ls apr-util-1.6.3

3. Extract and build libexpat

gunzip expat-2.6.3.tar.gz
tar xvf expat-2.6.3.tar
cd expat-2.6.3
./configure --prefix=/opt/portal/tmp/expat
make
make install

4. Extract and build pcre

gunzip pcre2-10.44.tar.gz
tar xvf pcre2-10.44.tar
cd pcre2-10.44
./configure --prefix=/opt/portal/tmp/pcre2
make
make install

5. Extract and build httpd

gzip -d httpd-2.4.62.tar.gz
tar xvf httpd-2.4.62.tar
cd httpd-2.4.62
cd srclib/
cp -r ../../apr .
cp -r ../../apr-util .
cd ..
export PCRE_CONFIG=/opt/portal/tmp/pcre2/bin/pcre2-config
./configure --prefix=/opt/portal/tmp/httpd --with-included-apr --with-expat=/opt/portal/tmp/expat  --with-pcre=/opt/portal/tmp/pcre2
make
make install

You should now be able to start https as

/opt/portal/tmp/httpd/bin/apachectl -k start

If you want customize the server setting use /opt/portal/tmp/httpd/conf/httpd.conf

Comments

Popular posts from this blog

Creating a simple SOAP web service using Eclipse

Simple REST web service using Eclipse