Installing Oracle XE on CentOS

Another Cricket World Cup is underway. England are fulfilling their traditional role of making all of the other teams look like world beaters.
To take my mind off this excruciating spectacle, I’ll concentrate this week on installing Oracle XE 11g on CentOS 7.

Before I get into the nuts and bolts of the installation…

Flavours of Linux

Whilst there are many Linux Distros out there, they all share the same common Linux Kernel. Within this there are a few Distros upon which most others are based.
Debian provides the basis for Ubuntu and Mint among others.
It uses the .deb package format.

Red Hat Linux in contrast uses the RPM file format for it’s packages. Red Hat is the basis for Distros such as Fedora, CentOS…and Oracle Linux.

For this reason, the Oracle Express Edition Linux version is packaged using rpm.
Whilst it is possible to deploy it to a Debian based Distro – instructions for which are available here, deploying on CentOS is rather more straightforward.
More straightforward, but not entirely so, as we will discover shortly…

Getting Oracle Express Edition 11G

Open your web browser and head over the the Oracle Express Edition download page.

You’ll need to register for an account if you don’t already have one but it is free.

The file you need to download is listed under :

Oracle Express Edition 11g Release 2 for Linux x64.

NOTE XE 11G only comes in the 64-bit variety for Linux. If you’re running a 32-bit version of your Distro, then you’re out of luck as far as 11G is concerned.

If you’re not sure whether you’re on 32-bit or 64-bit, the following command will help you :

uname -i

If this returns x86_64 then your OS is 64-bit.

Installing XE

You should now have downloaded the zipped rpm file which will look something like this :

cd $HOME/Downloads
ls -l
-rwxrwx---. 1 mike mike 315891481 Dec 16 20:21

The next step is to uncompress…


When you run this, the output will look like this :

   creating: Disk1/
   creating: Disk1/upgrade/
  inflating: Disk1/upgrade/gen_inst.sql  
   creating: Disk1/response/
  inflating: Disk1/response/xe.rsp   
  inflating: Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm 

You now need to switch to the newly created Disk1 directory and become root

cd Disk1

…and then install the package…

rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

If all goes well you should see…

Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-xe-11.2.0-1.0             ################################# [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

Configuring XE

The configuration will be prompt you for

  1. the APEX http port (8080 by default)
  2. the database (TNS) listener port (1521 by default)
  3. A single password to be assigned to the database SYS and SYSTEM users
  4. whether you want the database to start automatically when the system starts (Yes by default)

Unless you have other software, or Oracle Instances, running elsewhere, the defaults should be fine.

Here we go then, still as root, run :

/etc/init.d/oracle-xe configure

The output, complete with the prompts will be something like :

Oracle Database 11g Express Edition Configuration
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8081

Specify a port that will be used for the database listener [1521]:1525

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

Congratulations, you now have a running database. The first thing to do with it, however, is to shut it down.
In fact, we need to do a re-start so that the menu items that have been added as part of the installation are visible.
So, re-boot.

NOTE – from this point on you can stop being root (although you may need to sudo occasionally).

Once the system comes back, you will see the new Menu icons in the Applications menu under others :


Just to confirm that your database is up and running, you can select the Run SQL Command Line option from this menu
and run the following :

conn system/pwd
select sysdate from dual

This should return the current date.

Sorting out the Environment Variables

In the normal run of things, this is the one fiddly bit. There is a bug in one of the scripts Oracle uses to set the environment variables which may cause issues.

To start with, let’s have a look at the main environment script…

cat /u01/app/oracle/product/11.2.0/xe/bin/

This script is as follows :

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export NLS_LANG=`$ORACLE_HOME/bin/`
export ORACLE_BASE=/u01/app/oracle

There is a bug in the that is called from here. If you’re NLS_LANG value contains a space, then it will not be configured correctly. A full list of the affected NLS_LANG values is available on the Oracle XE Installation Guide for Debian based systems I mentioned earlier.

The easiest way to fix this is to just edit the script :

sudo gedit /u01/app/oracle/product/11.2.0/xe/bin/

Right at the bottom of the script where it says :

# construct the NLS_LANG

echo $NLS_LANG

…amend it so that the $NLS_LANG value is quoted :

# construct the NLS_LANG

echo $NLS_LANG

To test the change and make sure everything is now working properly…

cd /u01/app/oracle/product/11.2.0/xe/bin

. ./
echo $NLS_LANG
echo $PATH

You should now see the following environment variable settings :

echo $NLS_LANG

NOTE – the $NLS_LANG should have a setting appropriate for your system (in my case ENGLISH_UNITED KINGDOM.AL32UTF8).

The Oracle bin directory is now at the start of $PATH.

Next, we need to ensure that these environment variables are set for all sessions. This can be done by running …

sudo cp /u01/app/oracle/product/11.2.0/xe/bin/ /etc/profile.d/.

To check this, you can start a new terminal session and echo the environment variables to make sure they have been set.

Getting the Menu Items to Work

To do this, you simply need to make sure that the oracle user, as well as your own user, is a member of the dba group :

sudo usermod -a -G dba oracle
sudo usermod -a -G dba mike

To check :

sudo grep dba /etc/group

The menu items for starting up and shutting down the database etc. should now work.

Enabling the Getting Started Desktop Icon

The final touch. The installation creates a Getting Started icon on the desktop which is designed to open the Database Home Page of the APEX application that comes with XE.

In order to make it work as desired, you simply need to right-click the icon and select Properties.
In the Permissions Tab check the box to “Allow executing file as program”.
Close the window.

You will notice that the icon has transformed into the familiar Oracle beehive and is now called
Get Started With Oracle Database 11g Express Edition.

Clicking on it now will reward you with …


All-in-all then, this installation is reasonably painless when compared with doing the same thing on a Debian system.
I wish the same could be said of following the England Cricket Team.

12 thoughts on “Installing Oracle XE on CentOS

  1. Hi,

    I have followed this guide and I successfully installed XE with Apex 5 on CentOS. I had problems with accessing the apex link, but through localhost:port/apex, but when I disable the firewall it is working.

    Right now I am unable to access the app from external computer using the internal network IP allocated from my router.

    Do you know what is the issue? The CentOS is installed on VMware if that has any impact…


  2. Great tutorial. I did have to do one extra thing on my system. I had to add .localdomain to the /etc/hosts file in order that the config script would run. I added that entry to the loopback address and then the script ran.

    • Hugh,

      thanks for letting me know. I’m sure someone else will find this useful.
      Just out of interest, I did this on a clean install of CentOS7. The /etc/hosts file looks like this :		localhost.localdomain localhost
      ::1		localhost6.localdomain6 localhost6


  3. Thanks for the tutorial. It was very simple to follow.
    I setup the oracle server to port 80 but when I try to connect to localhost/apex/f?p=4950 I’m unable to connect.
    I disabled firewalld and set to FALSE the local access from SQL.
    What can I do or check?


    • Samuele,

      What is the error message you get ?
      Also, is there any reason you want to use port 80 ? This is the default http port so there may be something else trying to use it which could cause problems ? The default port used by Apex on Express Edition is 8080.

      This should become clearer from the error message.



      • Dear Mike, this morning I set the port to the default (8080) and everything worked fine.
        Standing at what I found on the internet it looks like that is a very complicated thing to make apex to work in a port lower da 1024. Someone is suggesting to use Apache as proxy.
        Anyway I don’t get any error on the browser but only “unable to connect” when I configure Oracle XE with port 80.

  4. Hi Mike,

    Thanks for the tutorial. It was very easy to follow.

    I can connect to oracle local host however, i cannot log in. I remember while installing it did ask password and dba name. I used that combination but it says access denied. Appreciate your help.


    • PK,

      are you trying to connect to the Admin application in a web browser ? If so, then you need to pass in the APEX application ID of the Admin application on the url.
      The full URL used in the Desktop shortcut is :


      NOTE – replace 8080 with the port number you specified in the installation if you did not use the default.



  5. Pingback: DIY TOPdesk Virtual Appliance knutselen (2) - Laansloot IT

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.