Gentoo/Apache

From Segfault
Jump to: navigation, search

As the software installation process is somewhat different in Gentoo Linux, let's see how Apache is installed and PHP is enabled, and later on an application is deployed.

Installation

 USE="cgi cli apache2" emerge --ask apache php

Now apache2 should be installed, with /etc/init.d/apache2 as an initscript and /var/www as its document root.

Configuration

We want to enable PHP:

 $ grep ^APACHE2_OPTS /etc/conf.d/apache2 
 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"

That way the "IfDefine PHP5" in /etc/apache2/modules.d/70_mod_php5.conf will take effect and load the libphp5.so module.

Deployment

As an example, let's install Nagios:

 USE="png jpeg" emerge media-libs/gd

Download & unpack nagios from here. Because of #244, we have to alter html/Makefile:

  sed 's/for file in includes\/rss.*\/\*/&.*/' -i.orig html/Makefile.in
 useradd -U -s /bin/sh -d /opt/nagios -g nagios nagios
 
 ./configure --prefix=/opt/nagios --with-httpd-conf=/etc/apache2/vhosts.d
 make all 
 make install install-cgis install-init install-config install-webconf

Links