Installing and Setting Up Apache2 on Ubuntu OS

This article describes an example of installing and setting up Apache HTTP Server (Apache 2) on Ubuntu OS (supported versions). If xvfb virtual display has already been set up in the operating system, system preparation is not required, and the user can simply start installation of Apache2.

System Preparation

Execute the following operations:

  1. Grant access to DISPLAY 0.0. To do this, open the X0.hosts file by executing the command in the terminal:

sudo nano /etc/X0.hosts

Add the string in the file that opens:

localhost

NOTE. If the physical display is set up to another number, specify the corresponding number after X.

  1. Open the xserverrc configuration file:

sudo gedit /etc/X11/xinit/xserverrc

Replace the string:

exec /usr/bin/X -nolisten tcp "$@"

with:

exec /usr/bin/X "$@"

  1. Open the lightdm.conf configuration file:

sudo gedit /etc/lightdm/lightdm.conf

Add the string to the end of the [SeatDefaults] group:

xserver-allow-tcp=true

  1. Restart X server:

sudo service lightdm restart

In order services work correctly, the user must log in to the graphic environment from physical console.

Installing and Setting Up Apache2

Execute the following operations:

  1. Install Apache2 server by executing the command in the terminal:

NOTE. Internet connection is required for installation.

sudo apt-get install apache2

sudo a2dismod mpm_prefork

sudo a2dismod mpm_event

sudo a2enmod mpm_worker

  1. Open the apache2.conf configuration file:

sudo gedit /etc/apache2/apache2.conf

NOTE. The file /etc/apache2/mods-enabled/mpm_worker.conf should be edited in Ubuntu 14.04 with Apache 2.4.

Change contents of the tag:

<IfModule mpm_worker_module>

to:

ServerLimit 1

StartServers 1

MaxClients 64

MinSpareThreads 32

MaxSpareThreads 64

ThreadsPerChild 64

MaxRequestsPerChild 0

  1. Create a configuration file:

sudo gedit /etc/apache2/mods-available/Foresight.conf

  1. Add the following strings to the file:

#Foresight Analytics Platform

Axis2RepoPath "/opt/Foresight/<Foresight Analytics Platform version>/bin"

Axis2LogFile "/opt/Foresight/<Foresight Analytics Platform version>/bin/logs/axis2.log"

Axis2LogLevel information

Axis2ServiceURLPrefix services

<Location /axis2>

SetHandler axis2_module

</Location>

  1. Create the Foresight.load file:

sudo gedit /etc/apache2/mods-available/Foresight.load

Add the following contents to the file:

# Foresight Analytics Platform

LoadModule axis2_module "/opt/Foresight/<version>/bin/libmod_axis2_[version].so"

NOTE. Specify the installed Apache2 version instead of the [version] value. Supported versions are 2.2 and 2.4, file name contains the values 2_2 or 2_4, respectively. By default, Ubuntu 12.04 enables the user to install Apache 2.2 from repository, and Ubuntu 14.04 enables the user to install Apache 2.4.

Connect the module:

sudo a2enmod Foresight

  1. Open the envvars configuration file:

sudo gedit /etc/apache2/envvars

Add the strings to the end of the file:

export TNS_ADMIN=/opt/Foresight/9.2/bin

export DISPLAY=localhost:987.0

export XAUTHORITY=/home/Foresight/.Xauthority

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Foresight/9.2/bin
#Uncomment line below to export extended log

#export PP_LOG=1

NOTE. Specify the number of the display server, on which graphics is rendered, in the DISPLAY environment variable. It is recommended to use xvfb virtual display No. 987, but it physical X server is used, specify its number DISPLAY=:0.0.

  1. Set the owner of the directory with installed Foresight Analytics Platform the user, under whom Apache2 is running:

sudo chown -R www-data:www-data /opt/Foresight/9.2

  1. Restart Apache2 using the "service" utility by executing the command in the terminal:

sudo service apache2 restart

  1. Check performance of the BI server started under HTTP Apache server by the URL in the browser: http://localhost:80/axis2/services/. A page with the list of BI server operations should open (see the Checking BI Server Performance section).