Posted on Monday, November 15, 2010 Installation of APEX 4.0 - Tomcat - APEX Listener in Ubuntu 10.04 Category Oracle Database 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: You have privilege to use sudo. Your system meets Swap Space Requirements for Oracle Database XE Server Server port 8080 is not reserved by other service All passwords is set to oracle. You should set different strong passwords. 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/