Installing Oracle Linux and Apex

Recently I had to set up an Oracle Apex Server. Unfortunately the Apex Installer is delivered only as Windows 32 Bit installer and as a Linux 64 Bit RPM package.
Since I did not have any 32 Bit windows running, and neither any Linux system, that normally uses RPM packages, I decided to give Oracle Linux a try as base for an Oracle APEX Server.

What is Apex?

APEX is a rapid application development tool from Oracle. It lets you design, implement and deploy database applications with a very easy to use web gui. For common task like showing reports or creating forms for data entry you can use one of the many prepared templates. With APEX you could create an entire application around your database with little to no knowledge of any programming or scripting language.
If you need more specialised pages, then the default templates offer to you , you can build a page from scratch with any combination of predefined elements, custom PL/SQL code and custom javascript / HTML code.

What are the requirements of APEX?

Apex needs an Oracle database to work with. But since the free Oracle XE comes with APEX already, there wont be any licensing fees for smaller Apex Applications. Oracle XE has some limitations on the amount of data you can store with it, the amount RAM it can use and it is limited to one core, but at the very least you can use it to check out Oracle and Apex before buying an Oracle License.
While Oracle XE come with a version of APEX, it does not come with the current version. I recommend to update the APEX version of Oracle XE since the new version has a few nice features.
Apex itself is a free download from the Oracle website, but you need to register an account on the website to download it. The same goes for the Oracle XE Database.

Anything that I need to watch while installing Oracle Linux?

The Oracle Linux installation is fairly standard for the most part. The only thing that you might stumble over is the network configuration. You have to explicitly enable every Network Adapter you want to use, otherwise you will not have any network access with the newly installed Linux until you enabled a Network Adapter from there.

Below is a small step by step guide for the installation. If you know how to install Linux you can skip all the pictures and continue reading at the next Heading.


Linux is up and running what now?

Before you try to install apex, you should make sure that Hostname of your Oracle Linux Machine can be resolved by the DNS Server it is using. The installation failed for me when that was not the case on my Server.
If your don’t have a local DNS Server or if you have no control over the DNS Server, you can also use the /etc/hosts file for name resolution. Open the file in you editor of choice and add a line like this:

# IP address of the host        hostname                     oraclelinux

How do I install Oracle XE and APEX?

Next on the Agenda is installing and configuring Oracle XE.

  1. Download Oracle 11g XE from Oracles website and copy it to your Server.
  2. Navigate to the directory you copied the download into and extract and install the package. The following example assumes /tmp as directory and the current version of Oracle XE at the time of this writing:
    cd /tmp
    unzip -x
    cd Disk1
    rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
  3. Once the installation is done, you have to configure the Database. This is done with following command:
    /etc/init.d/oracle-xe configure

    You will be asked a few questions and after that the configuration will be done. The configuration will fail, if it can’t resolve the hostname of the machine Oracle is on.
    The Script will ask for the following Information:
    – The HTTP Port for APEX: the default is 8080
    – The Port for the Oracle Listener: the default is 1521
    – The Password for the Administrative accounts of the Database (SYS and SYSTEM): choose a secure Password and write it down
    – Do you want the Database to start automatically.

  4. Once the configuration is complete, you need to log into your database with SQLPlus. But before you can do that, you will need to set some Environment variables. Oracle does provide a script to set them for you, but at least on my Oracle Linux test machine, the script didn’t work.
    Since the environment variables only need to be set, when you want to access the database from the command line, I set them by hand:
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
    export ORACLE_SID=XE
    export NLS_LANG=`$ORACLE_HOME/bin/`
    export PATH=$ORACLE_HOME/bin:$PATH
  5. Now you can run the sqlplus command from the command line to enter the Database.  You need to enter the Database as system and tell Oracle to respond to network connections. Run following command:
    sqlplus system

    You will be promted for the password that you set during the configuration. Once you have entered the password, you are in the command line interface of Oracle XE. Enter following line to enable the webserver for the network:


    Exit from sqlplus after that.

  6. While Apex is up and running now, you can still not access it, because of the firewall. To change the firewall settings execute following command on from your Linux command line:

    This will open a configuration menu for the firewall. Here you must first select the Option “Customise” and then press enter. Next you select “Forward”. On this screen select “add”. A new mask will pop up. fill it in like in the picture below:Port/Port Range: 8080 and Protocol: tcp
    Select “OK” when you are done and then select “Close” on the next screen. After that confirm all your changes with “OK”
    Now you should be able to contact the Oracle Apex Server from your workstation with the following url: http://ip.of.your.oraclelinux:8080/apex/apex
    If you can reach this page your Apex installation is good to go. You could start to work on your application, but I recommend installing the newest update for apex, before you start creating your own applications.

Updating apex to Version 4.2.2

Download the current APEX release from the Oracle website and copy it to a directory on your Oracle Linux Server. At the time of this writing the current Version of APEX is 4.2.2. This process will probably stay the same for all minor updates. The following steps will assume that you copied apex into the directory  “/tmp”

  1. Download the current APEX release from the Oracle website and copy it to a directory on your Oracle Linux Server.
  2. Enter the directory APEX is in and unpack it. and then enter the newly created directory:
    cd /tmp
    unpack -x
    cd apex
  3. Start sqlplus and connect with the user system. Please note that, as stated above, the correct environment variables need to be set for this.
    sqlplus sys as sysdba

    Enter your password when prompted and execute the following command:

    @apexins.sql sysaux sysaux temp /i/

    This runs the apex installation script with the following parameters:
    Tablespace for APEX user: sysaux
    Tablespace for APEX Files user: sysaux
    Temporary Tablespace: temp
    Virtual image directory: /i/
    The Values in the example command are correct for default apex installations. Don’t worry if this takes a while, that is normal.

  4. After the script is finished, you should check if the upgrade was successful. You can do this by executing following command in sqlplus:
    select status from dba_registry where comp_id = 'APEX';

    The out put should look like this:
    It should tell you that the result is valid.

  5. Since this was an Upgrade of APEX, it is necessary to load the images of the new version into the database.
    In order to do this, you need to start sqlplus as sysdba and run following command:

    @apxldimg.sql /tmp

    You need to specify the folder where you extracted apex to. If you followed the tutorial, you extracted apex to “/tmp”.

  6. If you want to change your password already you can do it with the following command in sqlplus:
  7. The update is complete. The apex Web Interface is available at http://ip.of.your.oraclelinux:8080/apex/apex

4 thoughts on “Installing Oracle Linux and Apex”

  1. Thank you for your very Generous work to show the way though this install. I am doing the same for a friend. Your example of installing APEX 4.2 onto Oracle Linux 6.0 is very useful and helped me ‘see ahead’ on the road to completion.
    Great help!

  2. tried with success up until setting the enviroment variables. I have done them as described but keep getting Cannot access NLS data files or invalid environment specified. when logging into sqlplus. Checked the path and the file is there but keep getting the error.

    1. Hey there, sorry you got caught in the spam filter (which I don’t check as often as I should).
      If you happen to read this try issuing the commands by hand. I have had problems when they were in scripts.
      If that does not help feel free to mail me or post here again.

Leave a Reply

Your email address will not be published. Required fields are marked *