Install Oracle 11gR2 Express Edition on Ubuntu 14.04 (64-bit)

Since I want to give as many as possible examples in my blog I needed to install a Oracle database on my Ubuntu 14.04 operating system first. This seems to be a very good starting point for one of my first posts.

Although Linux users are used to very handy install processes by just typing sudo apt-get ... commands the installation of an Oracle database is not as simple as that. The reason for this is that the Oracle database as an proprietary product is not provided in the public software repositories which the apt-get commands query.

Only for Testing and Developing!

Please, bear in mind that the described installation is intended for use in testing respectively developing stages. Itˋs not for production environments! Even the express edition is a limited version!

Prerequisites

  • you need to be a sudo
  • ubuntu libraries/packages need to be in place alienlibaio1, unixodbc

Installation

Before we can start with installation of the Oracle database, we need to ensure that a couple of additional Linux packages are installed. Prepare your system by installing the following package:

Next, you need to download the Linux x64 version of the Oracle Database 11g R2 Express Edition (link)

Unzipping

Navigate to your download folder and unzip the downloaded Oracle files. In my case this can be done by executing the following commands in your terminal.

and

A new directory Disk1 is added to the Download folder. You can jump into this folder by typing:

Convert the *.rpm Binary

Since Oracle does not support officially Ubuntu as a target platform the installation scripts are not compatible with the operating system (core Debian). But the good thing is, there are commands we can use to make from the rpm package a dep package which fits our operating system’s requirements.

Alien is such a tool which can be used to convert a package format into another. The command generates from the rpm package a dep one:

Depending on your system’s performance the conversation can take a while. After several minutes (please, do not interrupt the process) you will find the oracle-xe-11.2.0-1.0.x86_64.dep package in the Disk1 folder.

You might think that you are able to install the Oracle databases now, but you would get problems by just executing the *.dep installation routine. Why? Because a common Red Hat package, the package format Oracle provides, demands the /sbin/chkconfig file which is not required by Ubuntu.

Ubuntu does not use /sbin/chkconfig for installation.

In order to install a converted *.dep from a *.rpm package you must probably adjust or create the /sbin/chkconfig file.

We create and edit the chkconfig with the following commands:

Copy and paste the following lines into the editor save and close:

This „Ubuntu hack“ defines how the Oracle database can be started or stopped. It declares how the service can be used and which parameters it requires. Now we have to give the file some execution privileges.

You can test whether you have set the privileges correctly by listing the altered file (notice the x for user, group and others).

System Preconfigurations

There are several minor adjustments required before the installation/configuration of the Oracle database.

Adjust Kernel Parameters

The Oracle database requires a set of kernel parameters. Especially the maximum use of RAM, etc. These parameters will be configured in the 60-oracle.conf file. These files will be loaded during service startup. In this case when the Oracle database service starts.

Add the following lines:

Save and close the editor. Run the following command to apply the parameters:

Adjust Path to Pattern Scanning and Text Processing Language (awk)

Although the awk command is installed in each default Ubuntu installation the configuration util of the Oracle database does not search in the correct directories for it. This will lead to some warnings/errors during the configure phase. It is not a big problem since we have only to point to the already installed binary by just creating a link.

That’s it!

You might ask yourself why you will be faced this problem? Well, it is far easier than you think, Red Hat keeps the awk command under /bin and Ubuntu puts it under /usr/bin.

Adjustment in Mount Point

The Oracle database requires a separate mounting point which we can create with the following commands:

ORA-00845: MEMORY_TARGET

You will run into this issue when you do not configure a separate mount point for the Oracle database prior configuration phase.

Since the changes are only temporary for the current session they will be lost after system reboot. In order to make them permanent you can create a startup script for a specific run level. Lets add the prior steps to a file, make them executable and start them automatically while our system boots. This will ensure that the required mount point is accessible whenever we start the database manually.

We create first the file and open it with our favorite editor

Add the following lines:

Save the file and make it executable:

Additional Adjustments

Please, create the following directories/files

Package Installation and init

Now we are ready to start the installation of the generated oracle-xe_11.2.0-2_amd64.deb with the following commands:

The system will show you the following output:

The installation routine prompts you to run the following command to initiate/configure the database:

You can confirm all default port settings. In so far as the database is only for demonstration purposes I do not want to start it automatically on system startup. I answered the last question with N.

System Variables

Everyone who worked with Oracle products knows that Oracle uses a set of system/environment variables in order to configure or reference their software products. It is recommended to set the system variables for the user session. Since I do not want to configure this variables for all users who may work with my machine separately I want to define them on system-level and make them so accessible for everyone [bib]UbuntuHelpEnvornmentVariables[/bib].

We edit the sudo gedit /etc/environment  and replace the content by the following lines:

Restrictions in /etc/environment

Please, consider that you are not able to use any variable expansion in the /etc/environment [bib]UbuntuHelpEnvornmentVariables[/bib].

Although, many developers uses the /etc/bash.bashrc I decided not to use this but the more appropriated /etc/environment. The reason for this decision was that variables defined in the bash.bashrc are only visible to programs started by shell. This seems to be a restriction I do not want to accept.

Save the adjusted /etc/environment and close gedit.

Presence of System Variables

The /etc/environment will be executed automatically by the system during the start-up of the desktop. This means that even we have configured the environment variables they are not present, yet!

To solve this issue we must reboot to load our environment definitions. You can check if the system variables are present after reboot:

Now, we should have everything in place. The installation is completed!

Testing the Database

Lets see if we can start and connect to the database. We can start the database with:

Now lets try to login with the SYS and our entered password during configuration phase.

Now we can try to query a standard table of the database:

When you get an output you have got a working Oracle Express database on your system. Congratulation!

Start the Database Manually!

Do not forget to start manually the database after reboot! The database will not start automatically with system boot.

2 Gedanken zu “Install Oracle 11gR2 Express Edition on Ubuntu 14.04 (64-bit)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.