Wednesday, April 13, 2016

Installing APEX 5.0.3 and RESTful Services on Oracle 11gR2 and Oracle Enterprise Linux

Introduction

This is a high-level overview of installing APEX 5.0.3 on Oracle 11gR2 and Weblogic 10.3.6.  These instructions are distilled from Oracle installation guide:
https://docs.oracle.com/cd/E59726_01/install.50/e39144/toc.htm

Middleware is located here: /app/fmw
Weblogic domain is: /app/fmw/user_projects/domains/WLSDomain
Domain name is: WLSDomain

APEX will be installed here: /app/apex


Downloading Files

Download APEX from here:
http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

I selected:
Oracle Application Express 5.0.3 - English language only

Download REST data services from here:
http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html

Oracle REST Data Services 3.0.4

Installing APEX

Unzip the APEX download file:
cd /app
unzip ~/Downloads/apex_5.0.3_en.zip

cd /app/apex

Start SQL*Plus and login as SYSDBA

Install the full development environment
@apexins.sql SYSAUX SYSAUX TEMP /i/

Thank you for installing Oracle Application Express 5.0.3.00.03

Oracle Application Express is installed in the APEX_050000 schema.

The structure of the link to the Application Express administration services is as follows:
http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
http://host:port/apex/apex_admin     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex/apex_admin     (Oracle REST Data Services)

The structure of the link to the Application Express development interface is as follows:
http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)
http://host:port/apex     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex     (Oracle REST Data Services)


PL/SQL procedure successfully completed.

Install Oracle REST Data Services

mkdir /app/ords
cd ords
unzip ~/Downloads/ords.3.0.4.60.12.48.zip

mkdir /app/ords/restdata

cd /app/ords
$ java -jar ords.war
This Oracle REST Data Services instance has not yet been configured.
Please complete the following prompts

Enter the location to store configuration data:/app/ords/restdata
Enter the name of the database server [localhost]:
Enter the database listen port [1521]:
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:orcl
Invalid value. Try again.
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:1
Enter the database service name:orcl
Enter the database password for ORDS_PUBLIC_USER:
Confirm password:

Please login with SYSDBA privileges to verify Oracle REST Data Services schema. Installation may be required.


Enter the username with SYSDBA privileges to verify the installation [SYS]:
Enter the database password for SYS:
Confirm password:
Apr 08, 2016 12:53:12 PM oracle.dbtools.rt.config.setup.SchemaSetup addSchemaParams
INFO: 
Oracle REST Data Services schema does not exist and will be created. 


Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.
If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:1
Enter the database password for APEX_PUBLIC_USER:
Confirm password:
Enter 1 to specify passwords for Application Express RESTful Services database users (APEX_LISTENER, APEX_REST_PUBLIC_USER) or 2 to skip this step [1]:
Enter the database password for APEX_LISTENER:
Confirm password:
Enter the database password for APEX_REST_PUBLIC_USER:
Confirm password:
Apr 08, 2016 12:55:47 PM oracle.dbtools.common.config.file.ConfigurationFilesBase update
INFO: Updated configurations: defaults, apex, apex_pu, apex_al, apex_rt
Apr 08, 2016 12:55:47 PM oracle.dbtools.installer.Installer installORDS
INFO: 
Installing Oracle REST Data Services version 3.0.4.60.12.48
... Log file written to /app/ords/logs/ordsinstall_2016-04-08_125547_00660.log
... Verified database prerequisites
... Created Oracle REST Data Services schema
... Created Oracle REST Data Services proxy user
... Granted privileges to Oracle REST Data Services
... Created Oracle REST Data Services database objects
Apr 08, 2016 12:56:02 PM oracle.dbtools.installer.Installer installORDS
INFO: Completed installation for Oracle REST Data Services version 3.0.4.60.12.48. Elapsed time: 00:00:15.228 

Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2

Deploying to Oracle Weblogic Server

java -jar ords.war static /app/apex/images
WAR Generation complete
 WAR location     : /app/ords/i.war
 Context path     : /i
 Static resources : /app/apex/images
Ensure the static resources are available at path: /app/apex/images
on the server where the WAR is deployed

Login to Weblogic server
Select Deployments
Click Install
Path: /app/ords/ords.war
Click Next
Install this deployment as an application and click Next
For Available targets for ords : select AdminServer and click Next
Name: ords
Security: Custom Roles: Use roles that are defined in the Administration Console; use policies that are defined in the deployment descriptor
Source accessibility - Select: Use the defaults defined by the deployment's targets
Click Next
Select Yes, take me to the deployment's configuration
Click Finish
Click Save

Now deploy the i.war file
Repeat above steps for i.war

Configuring WebLogic to Handle HTTP Basic Challenges Correctly


vi /app/fmw/user_projects/domains/WLSDomain/config/config.xml

add the following:

...
...
<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>
</security-configuration>

Save the updated config.xml file, and restart WebLogic if it is running

Verifying the State and Health of apex and i
In the Summary of Deployments, select the Control tab and verify that both the apex/ords and i State are Active and the Health status is OK

If apex or i are not Active, then enable them. In the Deployments table, select the check box adjacent to apex and/or i. Click Start and select Servicing all requests to make them active.

Add ADMIN Account

Start SQL*Plus as sysdba

cd /app/apex
SQL> @apxchpwd.sql
========================================================================
This script can be used to change the password of an Application Express
instance administrator. If the user does not yet exist, a user record will be
created.
========================================================================
Enter the administrator's username [ADMIN] 
User "ADMIN" exists.
Enter ADMIN's email [ADMIN] admin@localhost
Enter ADMIN's password [] Welcome1!
Changed password of instance administrator ADMIN.

Configure RESTful Services
sqlplus '/ as sysdba'
SQL> apex_rest_config.sql

Enter a password for the APEX_LISTENER user              [] 
Enter a password for the APEX_REST_PUBLIC_USER user              [] 
...create APEX_LISTENER user

PL/SQL procedure successfully completed.


Session altered.


PL/SQL procedure successfully completed.

SQL> 

Granting Connect Privileges Prior to Oracle Database 12c


DECLARE
  ACL_PATH  VARCHAR2(4000);
BEGIN
  -- Look for the ACL currently assigned to '*' and give APEX_050000
  -- the "connect" privilege if APEX_050000 does not have the privilege yet.

  SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
   WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;

  IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_050000',
     'connect') IS NULL THEN
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
     'APEX_050000', TRUE, 'connect');
  END IF;

EXCEPTION
  -- When no ACL has been assigned to '*'.
  WHEN NO_DATA_FOUND THEN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_050000', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;

Connect to APEX Sign In Page as Admin

http://localhost:7001/ords/apex_admin

No comments:

Post a Comment