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.
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 192.168.0.1 oraclelinux
How do I install Oracle XE and APEX?
Next on the Agenda is installing and configuring Oracle XE.
- Download Oracle 11g XE from Oracles website and copy it to your Server.
- 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 oracle-xe-11.2.0-1.0.x86_64.rpm.zip cd Disk1 rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
- Once the installation is done, you have to configure the Database. This is done with following command:
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.
- 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/nls_lang.sh` export PATH=$ORACLE_HOME/bin:$PATH
- 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:
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.
- 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:
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”
- Download the current APEX release from the Oracle website and copy it to a directory on your Oracle Linux Server.
- Enter the directory APEX is in and unpack it. and then enter the newly created directory:
cd /tmp unpack -x apex_4.2.2.zip cd apex
- 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.
- 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';
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:
You need to specify the folder where you extracted apex to. If you followed the tutorial, you extracted apex to “/tmp”.
- If you want to change your password already you can do it with the following command in sqlplus:
- The update is complete. The apex Web Interface is available at http://ip.of.your.oraclelinux:8080/apex/apex