Friday, 19 June 2015

Building an Oracle 11G XE Server with APEX 5, ORDS and SQLcl in 30 minutes

Pre-requisites

1. You have VirtualBox installed

2. You have the necessary Oracle installation files (oracle-xe, apex5, ords3 and sqlcl)




3. You have the installation image for CentOS - I just grabbed the Minimal image from a local mirror - http://centos.mirror.digitalpacific.com.au/7/isos/x86_64/

Set up the virtual machine

Give the Virtual machine an appropriate name, and since CentOS is based off Red Hat, specify the type as Red Hat (64-bit).



Allocate 1GB RAM



Create a new virtual hard drive (for this demo, I will go with a 10gb disk size).






Your machine and virtual hard drive will now have been created and you should see the machine in your machine list in Virtual Box. The next step is go into settings to apply some configuration.

Firstly, you will want to verify your network configuration - for this demo, I will just be using a bridged network connection.



You will also want to load in the Linux disk image. This is done through the storage tab by selecting the empty disk node and selecting the image - mine has been used in the past, so I can easily select it without locating a new disk.



Now we can start up the machine and install the operating system.

Before you begin the installation process you will want to go into network configuration and turn on the device as well as giving the machine a host name.



Once the installation begins, you will want to set the root password and create a personal user account. Here, I also make my self an administrator - this will allow us to run commands as root using the sudo command.



Once that process has finished, you can reboot the machine to get into your newly installed system.

Transferring the Oracle files to your machine

Before getting started we need to have all the installation media on our new server. I have already downloaded these files onto my machine. So first, I'll create a folder on the server where I will transfer these to.

mkdir ~/orafiles

Then to transfer the files across, I'll use FileZilla (an FTP program). We can connect here using sftp (which uses the SSH port/22).



Installing Oracle XE, APEX, ORDS and SQLcl

The next step is to install Oracle. There is a project on GitHub that has some scripts that basically automate the whole installation process. So for this, we will need to first install git.

sudo yum install git

The project is located at: https://github.com/OraOpenSource/oraclexe-apex

So, we need to clone the project onto our server, which is done with the following command.

git clone https://github.com/OraOpenSource/oraclexe-apex.git

This will clone all the project files into a new folder named oraclexe-apex at the current file location. The next step is to change into that directory

cd oraclexe-apex

In this folder, there is a config file that needs updating - config.properties. One editor that comes installed on our minimal CentOS is vi, but you can install another if you prefer - a popular choice is nano.

vi config.properties

The important properties you need to add a value for are:

  • OOS_ORACLE_FILE_URL 
  • OOS_APEX_FILE_URL
  • OOS_ORDS_FILE_URL
  • OOS_SQLCL_FILE_URL

These all related to the Oracle installation media that we copied over to the server in the previous step. So the top of the config file should end up looking something like:

#To download Oracle XE, go to: http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html
OOS_ORACLE_FILE_URL=file:///home/trent/orafiles/oracle-xe-11.2.0-1.0.x86_64.rpm.zip

#To download APEX, go to: http://download.oracleapex.com
OOS_APEX_FILE_URL=file:///home/trent/orafiles/apex_5.0_en.zip

#To download ORDS, go to: http://www.oracle.com/technetwork/developer-tools/rest-data-services/overview/index.html
#Note, for now ORDS 2 is in production. ORDS 3 specific scripts have also been included and need to be finalized once its out of beta
OOS_ORDS_FILE_URL=file:///home/trent/orafiles/ords.3.0.0.121.10.23.zip

#To downlaod SQLcl, go to: http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
#Note: at time of writing SQLcl is still in beta
#No default value in here since only if you want to add it in (not required)
OOS_SQLCL_FILE_URL=file:///home/trent/orafiles/sqlcl-4.2.0.15.121.1046-no-jre.zip


The path starts with file:///home/trent/orafiles because my user account is named trent, and I placed all the files in a new folder named orafiles.

The rest of the parameters are quite self explanatory - mostly relating to ports to use for various services.

The script also creates an APEX workspace during the installation. If you don't wish to create a workspace/user during the installation, you can set the property OOS_ORACLE_CREATE_USER_YN to N. Otherwise, you can update the property OOS_APEX_USER_WORKSPACE to your preferred workspace name.

I'd also suggest updating OOS_APEX_ADMIN_EMAIL to something other than admin@domain.com (default).

Now, we can start the installation process.

sudo ./build.sh

This installation process should take around 20 minutes to complete. After it completes, the script is set to reboot the machine - so ensure you save any unsaved work before running the above.

Once it has completed and successfully rebooted, you should then be able to access APEX on port 80. e.g. if your IP address of your machine is 192.168.1.10, you would access with: http://192.168.1.10. The default login details for the internal workspace are admin/Oracle1! (if you didn't update those configuration parameters).

It's also worth noting that the default configuration doesn't leave open port 1521 for connecting to the database. So you will need to set up SSH port forwarding on your local machine in order to connect (or open that port on the server). SQL Developer has support for this from within the software.

4 comments:

  1. Hey,
    i did everything as described in your post.OracleXE, apex and node are running correctly. If I create a RESTful Web service like Oracle describe in this video https://www.youtube.com/watch?v=gkCvd6P8_OU I get a 404 Not Found Error Message. I use this url
    http://localhost:9980/ords/oos_user/employee_test

    For the installation I use exactly like you:
    oracle-xe-11.2.0-1.0.x86_64.rpm.zip
    apex_5.0_en.zip
    ords.3.0.0.121.10.23.zip

    Did you get the RestDataService correctly running?

    I look forward reading soon something from you,
    thanks,
    markus

    ReplyDelete
    Replies
    1. Hi Markus,

      Thanks for the report. I was able to re-produce the 404 following on from that video.

      I found that on the Resource Template, when you specify the URI prefix, it is important to add the forward slash at the end. So it would be `employee_test/` instead of `employee_test`.

      See also: https://github.com/OraOpenSource/oraclexe-apex/issues/107

      Hope it helps,

      Cheers,

      Delete
    2. Perfect! Now it works... Thank a lot!!!

      Delete
  2. Hi,
    I would like to know installation of ORDS in Oracle 11 g(XE) with standalone mode.
    Please suggest me for this.
    Thanks

    ReplyDelete