Skip to Main Content

Installation of APEX 4.0 - Tomcat - APEX Listener in Ubuntu 10.04

This guide describes how to install APEX 4.0 with Tomcat and APEX Listener as backends in Ubuntu 10.04 server.

In this guide we make assumptions:

First of all, setup Oracle XE database.
Add Oracle XE repository. Create empty file:

sudo nano /etc/apt/sources.list.d/oracle-xe.list

Paste to the file:

deb http://oss.oracle.com/debian unstable main non-free

Add repository GPG key:

wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -

Update sources:

sudo apt-get update

Install Oracle XE universal:

sudo aptitude install oracle-xe-universal

Backup oracle-xe init script

sudo cp /etc/init.d/oracle-xe /etc/init.d/oracle-xe_original
sudo chmod a-xw /etc/init.d/oracle-xe_original

Edit oracle-xe init script to fix LD_LIBRARY_PATH problem.
Read Flavio Casetta blog post LD_LIBRARY_PATH is not set! in alert_XE.log

sudo nano /etc/init.d/oracle-xe

Add after export ORACLE_SID:

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

Configure Oracle XE. Accept all default values:

sudo /etc/init.d/oracle-xe configure

Backup nls_lang.sh:

sudo cp /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh_original
sudo chmod a-w /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh_original

Edit nls_lang.sh:

sudo nano /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh

Change first line to be:

#!/bin/bash

Change /etc/profile file:

sudo nano /etc/profile

Add end of file:

. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

Download APEX install files to /tmp. Give permissions oracle user to zip:

sudo chown oracle:dba apex_4.0.2.zip

Change user to oracle:

sudo su - oracle

Change directory /tmp:

cd /tmp

Unzip APEX install files:

unzip apex_4.0.1.zip

Change directory /tmp/apex:

cd /tmp/apex

Login to sqlplus:

sqlplus '/as sysdba'

Drop old APEX images from database:

begin
 dbms_xdb.deleteresource('/i/', DBMS_XDB.DELETE_RECURSIVE_FORCE);
 commit;
end;
/

Remove old APEX jobs, flows files and public synonyms:

begin
  flows_020100.wwv_flow_upgrade.remove_jobs;
  flows_020100.wwv_flow_upgrade.flows_files_objects_remove('FLOWS_020100');
  flows_020100.wwv_flow_upgrade.drop_public_synonyms;
  commit;
end;
/

Drop old APEX objects own by SYS

begin
  execute immediate 'drop package WWV_FLOW_VAL';
  execute immediate 'drop library WWV_FLOW_VAL_LIB';
  execute immediate 'drop package HTMLDB_SYSTEM';
  execute immediate 'drop public synonym HTMLDB_SYSTEM';
  commit;
end;
/

Remove old APEX installation:

drop user flows_020100 cascade;
drop user flows_files cascade;

Close XDB HTPP and FTP port. Set listener local access:

begin
  dbms_xdb.setlistenerlocalaccess(true);
  dbms_xdb.sethttpport(0);
  dbms_xdb.setftpport(0);
  commit;
end;
/

Alter system to register changes:

ALTER SYSTEM REGISTER;

Upgrade OWA_UTIL:

@/tmp/apex/owa/owainst.sql

Compile invalid objects:

@?/rdbms/admin/utlrp.sql

Install new APEX. This take a while. Go get coffee or tea.

@apexins SYSAUX SYSAUX TEMP /i/

Login again to sqlplus:

sqlplus '/as sysdba'

Configure JOB_QUEUE_PROCESSES:

ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 5 SCOPE=BOTH;

Configure SHARED_SERVERS:

ALTER SYSTEM SET SHARED_SERVERS = 5 SCOPE=BOTH;

Compile invalid objects:

@?/rdbms/admin/utlrp.sql

Check install is OK:

select comp_name,
  version,
  status 
from dba_registry 
where comp_id = 'APEX';

Check that there are not invalid objects:

select count(1) AS inv_obj_count 
from dba_objects 
where status != 'VALID';

Configure APEX_PUBLIC_USER Account:
NOTE! use other password than oracle.

ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER IDENTIFIED BY oracle;

Set APEX ADMIN user password:

@apxchpwd

Exit sqlplus:

exit

Logout oracle user:

exit

Move APEX install files from /tmp to ORACLE_HOME:

sudo mv /tmp/apex /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
sudo chown oracle:dba -R /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex
sudo chmod -R a-w /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex/images
sudo chmod -R a+r /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex/images

Install Tomcat:

sudo aptitude install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples unzip

Stop Tomcat:

sudo /etc/init.d/tomcat6 stop

Download APEX Listener install zip and place to /tmp. Unzip APEX Listener install files:

unzip apex_listener.1.0.2.238.15.24.zip

Copy apex.war to tomcat webapps:

sudo cp /tmp/apex.war /var/lib/tomcat6/webapps

Backup tomcat-users.xml:

sudo cp /etc/tomcat6/tomcat-users.xml /etc/tomcat6/tomcat-users.xml_original
sudo chmod a-w /etc/tomcat6/tomcat-users.xml_original

Edit tomcat-users.xml:

sudo nano /etc/tomcat6/tomcat-users.xml

Add after line <tomcat-users>:
NOTE! use other user name and password than oracle.

<role rolename="admin"/>
<role rolename="manager"/>
<role rolename="Admin"/>
<role rolename="Manager"/>
<user username="oracle" password="oracle" roles="admin,manager,Admin,Manager"/>

Make symbolic link for APEX images to Tomcat webapps:

sudo ln -s /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex/images /var/lib/tomcat6/webapps/i

Start Tomcat:

sudo /etc/init.d/tomcat6 start

Open browser and go URL:

http://yourserver:8080/apex/listenerConfigure

Configure APEX listener:

  • Set Password same as you did set for user APEX_PUBLIC_USER previously
  • Hostname: localhost
  • SID: XE
  • Go Security tab and open "Database Validation Function"
  • Enter to Validation Function: wwv_flow_epg_include_modules.authorize
  • Press Apply
  • APEX login page should open

Copy apex-config.xml from temp:

sudo cp /tmp/tomcat6-tmp/apex/apex-config.xml /etc/tomcat6

Stop Tomcat:

sudo /etc/init.d/tomcat6 stop

Backup apex-config.xml:

sudo cp /etc/tomcat6/apex-config.xml /etc/tomcat6/apex-config.xml_original
sudo chmod a-w /etc/tomcat6/apex-config.xml_original

Give permissions to tomcat6 group:

sudo chown tomcat6:tomcat6 /etc/tomcat6/apex-config.xml
sudo chmod ug+w /etc/tomcat6/apex-config.xml

Backup APEX Listener web.xml:

sudo cp /var/lib/tomcat6/webapps/apex/WEB-INF/web.xml /var/lib/tomcat6/webapps/apex/WEB-INF/web.xml_original
sudo chmod a-w /var/lib/tomcat6/webapps/apex/WEB-INF/web.xml_original

Edit web.xml:

sudo nano /var/lib/tomcat6/webapps/apex/WEB-INF/web.xml

Add after line <servlet-class>oracle.dbtools.apex.ModAPEX</servlet-class>:

<init-param><param-name>config.dir</param-name>
<param-value>${catalina.base}/conf</param-value></init-param>

Start Tomcat:

sudo /etc/init.d/tomcat6 start

Now you can access APEX from url

http://yourserver:8080/apex/

Comments

  • wattsup 27 Jan 2012
    Jari, I removed
    <init-param>
           <param-name>config.dir</param-name>
           <param-value>${catalina.base}/conf</param-value>
    </init-param>
    
    and replaced it with
    <context-param>
            <param-name>config.dir</param-name>
            <param-value>${catalina.base}/conf</param-value>
    </context-param>
    
    and it now retains the configuration. Thank you very much!
  • Jari Laine 25 Jan 2012

    Hi,

    On never version than 1.0 of APEX Listener, you need add below lines to file /var/lib/tomcat6/webapps/apex/WEB-INF/web.xml

    <context-param>
      <param-name>config.dir</param-name>
      <param-value>${catalina.base}/conf</param-value>
    </context-param>
    

    Add those after:

    <display-name>APEXMod</display-name> 

    Regards, Jari

  • wattsup 24 Jan 2012
    I followed the guide:
    sudo nano /var/lib/tomcat6/webapps/apex/WEB-INF/web.xml
    Add line:
    <init-param>
    <param-name>config.dir</param-name>
    <param-value>${catalina.base}/conf</param-value>
    </init-param>
    I also tried changing param-value to /etc/tomcat6/apex but I still have to reconfigure the listener after a reboot. Should my <param-value> be pointing somewhere else? Thank you
  • Jari Laine 24 Jan 2012

    Hi,

    Did you modify APEX Listener web.xml as mentioned in guide? If you do not modify web.xml and define where config file should be stored, temp directory is used. Tomcat deletes temp directory content on restart.

    Regards, Jari

  • wattsup 23 Jan 2012
    Thanks for the quick response. I followed your instructions and reconfigured the listener, after a reboot it lost its configuration and I had to reconfigure the listener again. I've read a bit on the configuration file. From what I can tell the config file is not being created in a temp or permanent place. Like it's in memory?
  • Jari Laine 20 Jan 2012

    Hi,

    If you have follow my guide, but used never version than 1.0 of APEX Listener, then do following.

    Stop Tomcat:

    sudo /etc/init.d/tomcat6 stop

    Create new folder:

    sudo mkdir /etc/tomcat6/apex

    Set folder permissions:

    sudo chown tomcat6:tomcat6 /etc/tomcat6/apex

    Start Tomcat:

    sudo /etc/init.d/tomcat6 start

    Configure listener again, and on next reboot configuration should persists.

    You can find more info about configuration file from Installation Guide.

    See "About the Listener Configuration File".

    Regards, Jari

  • wattsup 19 Jan 2012

    Awesome walkthrough. I followed every step exactly and have an issue after reboot. Every time the server reboots I have to reconfigure the APEX listener at

    http://host:8080/apex/listenerConfigure

    Any suggestions?

  • jeanichar 17 May 2011
    I loved your post. It had all the details. I was able to follow the instructions and get apex working. Thank you !