Monday, May 26, 2014

Installing Apache 2.4.9 httpd from source

Most often we install Apache httpd using pkg manager on the EC2 instances. However, on some situations, it may be necessary to install Apache httpd from source. It is better to pick the latest version of the below packages from Apache download site:-


  • Apache Portable Runtime (APR) version 15.1 - apr-1.5.1.tar.bz2
  • APR util version 1.5.3 - apr-util-1.5.3.tar.bz2
  • Perl Compatible Regular Expressions (PCRE) version 8.35 - pcre-8.35.tar.bz2
  • Apache httpd dependencies version 2.4.9 - httpd-2.4.9-deps.tar.bz2
  • Apache httpd 2.4.9 - httpd-2.4.9.tar.bz2
  • Update the EC2 instance with dependencies ($yum install gcc libxml2-devel gcc-c++ libicu-devel libxslt-devel bzip2 bzip2-devel libjpeg-devel libpng libpng-devel freetype freetype-devel curl curl-devel t1lib-devel unixODBC-devel openssl-devel openssl)
Copy all the src files into /usr/local/src folder and start installing the packages in the order below:-

APR installation:

*******
$cd /usr/local/src/
$tar xvjf apr-1.5.1.tar.bz2
$cd apr-1.5.1
$./configure --prefix=/usr/local/share/applications/apache2
$make
$make install
*******

APR Util installation:

*******
$cd /usr/local/src/
$tar xvjf apr-util-1.5.3.tar.bz2
$cd apr-util-1.5.3
$./configure --prefix=/usr/local/share/applications/apache2 --with-apr=/usr/local/share/applications/apache2
$make
$make install
*******

PCRE installation:

*******
$cd /usr/local/src/
$tar xvjf pcre-8.35.tar.bz2
$cd pcre-8.35
$./configure --prefix=/usr/local/share/applications/apache2
$make
$make install
*******

Apache httpd installation:

*******
$cd /usr/local/src/
$tar xvjf httpd-2.4.9-deps.tar.bz2 -C /usr/local/src/
$tar xvjf httpd-2.4.9.tar.bz2 -C /usr/local/src/
$./configure --prefix=/usr/local/share/applications/apache2 --with-apr=/usr/local/share/applications/apache2 --with-apr-util=/usr/local/share/applications/apache2 --with-pcre=/usr/local/share/applications/apache2 --with-ldap --enable-so --enable-auth-digest --enable-authz_owner --enable-log_config --enable-logio --enable-ext_filter --enable-mime_magic --enable-expires --enable-deflate --enable-headers --enable-usertrack --enable-dav --enable-info --enable-vhost_alias --enable-speling --enable-substitute --enable-rewrite --enable-proxy --enable-proxy_balancer --enable-proxy_ftp --enable-proxy_http --enable-proxy_ajp --enable-proxy_connect --enable-cache --enable-version --enable-ssl --enable-so
$make
$make install
*******

Next copy the attached httpd startup script (httpd) into /etc/init.d/ folder as root and give execute permissions on the script - 

-rwxr-xr-x. 1 root root  3462 Apr 29 20:07 httpd

You can also add httpd as service using "chkconfig"

$sudo chkconfig --add httpd
$sudo chkconfig --level 2345 httpd

Next you can try to bring up httpd process 

$sudo service httpd start

NOTE - Pl. change the user/group for httpd to run as a lesser privileged user (daemon/daemon)





No comments:

Post a Comment