Home / Featured / Installing Oracle 11gR2 on Ubuntu 12.04

Installing Oracle 11gR2 on Ubuntu 12.04

This howto should guide you though the installation of an Oracle Database 11g Release 2 on Ubuntu 12.04. Ubuntu is not officially supported by Oracle so there will be a few tweaks to achieve a working solution.
I hope this might help you if you aim for a similar task.

Before we start with this Chapter I assume you have a clean Ubuntu 12.04
Server up and running. If that is not the case please check out my previous
post Ubuntu 12.04 LTE Server on Virtualbox 4.1 installation.


1. Download Oracle

first download the full Version of Oracle 11gR2 for linux OS from the Oracle side. Safe the 2 files somewhere on your local PC. We will transfer them later to the VM.

2. Prepare the System

We have to install a few required packages for Oracle. Best way to install those is to use the standard debian package manager. As I have installed Ubuntu on my Server and work primary on my MacBook Air
I will open a Terminal session and SSH into the Server as root. You can of course also just enter the commands direct into the VM’s terminal to install the following packages:


3. Pre-Checks

check your /etc/hostname that it looks like below:


and also check that in /etc/hosts the below line is present:


4. Configure Memory Settings

For the installation we need a minimum of 1GB physical memory which we define when we setup the Virtual Machine earlier, else you can check it with the following command:


Because the Oracle installation is demanding in resources we create some temp swap-space that will disappear after a reboot. Bare that in mind, if you reboot the Server before completing the Oracle installation you have to redo the below steps.

Check your current swap-space with this command:


Now let’s create a temporary swap file for the installation.


Execute the command again to confirm the added swap-space


Shared Memory is also important for Oracle, else you might face some ORA-00845 error messages.
Check your current Shared Memory with this command:


If you have less than 512MB edit /etc/fstab and add (either 1024M or 1512M) I am adding here 1.5GB by adding the following line:

After remount and check the new size once again:


5. System Group and Users

remember we did not create any Users with our Ubuntu installation so lets do that now


6. Configure Kernel

Oracle requires additional kernel parameters, you either create a new kernel parameter file or add it to the existing system kernel. I choose to add them to the existing system file. So lets make first a backup

Backup the original system file /etc/sysctl.conf by executing:



Execute the following command to simply paste in the parameters:

cat - >> /etc/sysctl.conf

Now cut and paste the following

then press Ctrl-d to write the file


kernel.shmmax = max possible value, e.g. size of physical RAM.

Verify the above with:


and load the new Kernel parameter with the following command:


Verify the new kernel settings:


that should return — fs.aio-max-nr = 1048576

Before we now set the Oracle limits lets backup the original file:


Next add the following limits to /etc/security/limits.conf:

cut and paste the following and then write to the file with Ctrl-d


Check/add if the following line exits within /etc/pam.d/login


Check if the following line exits within /etc/pam.d/su


7. Create Oracle directories

It’s time to create some directories for Oracle and set the permissions.


8. Configuring the oracle user’s environment

Add following lines to /var/lib/oracle/.profile
We are creating here a AL32UTF8 database, so change this to US7ASCII if you want to create and ASCII database. This will also map Oracle’s /bin to your $PATH to run Oracle’s binary directly at login:


9. Fake Oracle installer

As mentioned before , Ubuntu is not listed as Oracle officially support platform and so we need
to fake it by creating symbolic links:


Mask ourself as RedHat:


10. Copy the Oracle installation files to the Server

We discussed in the pre-post PuTTY, so we going to use that now to copy the files over to the Server. Copy the file 2 files (linux.x64_11gR2_database_*.zip to oracle’s home directory and unzip them


In case that cp don’t work use the scp command that comes with PuTTY to copy the files over.


11. Starting Oracle Installer

Before we can do that we have to export the Display on our Ubuntu Server as root.
Go to your Ubuntu VM and login as root if not already and execute the following commands:


Next go back to PuTTY session and login to the Server as oracle (su – oracle if you are already as root).
No change to the database directory and start the installer with the following command:



At the first screen of the Oracle Installer you can add your support Account if you have one, In case
you don’t just leave it empty and remove the default tick box for the email.












At the next tab [Select Installation Option] – choose the first setting Create and configure a database:












In [System Class] – choose Server Class:












In [Node Selection] – choose the option Single instance database installation:












In [Select Install Type] – choose Advanced install:












In [Select Product Languages] – choose to install at your demand I select all available languages:












In [Select Database Edition] – choose Enterprise Edition:












In [Specify Installation Location] – the default settings should be as below:

Oracle Base: /u01/app/oracle
Sofeware Location: /u01/app/oracle/product/11.2.0/dbhome_1













In [Create Inventory] –  it should default as below:

Inventory Directory: /u01/app/oraInventory
oraInventory Group Name: oinstall













In [Select Configure Type] – choose General Purpose / Transaction Processing:













In [Specify Database Identifiers] – configure as below:

Global database name: AL32UTF8.localdomain
Oracle Service Identifier (SID): AL32UTF8













In [Specify Configuration Options] – configure as below:

Memory -> Enable Automatic Memory Management: TRUE
Character sets: Use Unicode (AL32UTF8)























In [Specify Management Options] – choose Use Database Control for database management
and leave the rest as default:













In [Specify Database Storage Options] – choose File System where:

Specify database file location: /u01/app/oracle/oradata













In [Specify Recovery Options] – choose Do not enable automated backups:













In [Specify Schema Passwords] – choose to your passwords and write them down:













In [Privileged Operating System Groups] – confirm as below:

Database Administrator (OSDBA) Group: dba
Database Operator (OSOPER) Group: oinstall













In [Preform Prerequisite Checks] –  just simply ignore all warning message
(since we are using Debian but not Oracle officially supported OS):













So just confirm everything in Summary:













And now let’s go for a coffee/tee break – you deserve it













Special note for Ubuntu 12.04: If you face error during installation so update as below:













When you see the above error, open a new session to the Server and execute the below commands:



Then press Continue and keep going …













Now following the instructions and run the following commands with root user:














Confirm with installation progress













In previous screen the installer mentioned that we can access Enterprise Manager Database Control URL
from https://localhost.localdomain:1158/em, so now let’s open the browser and test it with following account:

User Name: SYS
Password: your_secret_password
Connect As: SYSDBA

Once login it should show as below:


12. Post Configurations – Autostart Oracle during system boot

I like if everything boots up automatic so lets configure Oracle to start during system boot. You can of course
turn this feature later off, but the init.d script is very useful too. First we need to specify which database
instant will be started together with Oracle. (of course this is the first but maybe you have already done
this a few times).
Edit /etc/oratab as below:



Now lets create the init.d script as /etc/init.d/oracle


copy and paste all below and complete it with Ctrl-d


Set the Permission:


Finally we need to install the script so Oracle will start during system bootup:



NOTE: You may find the following error message during /etc/init.d/oracle/stop:
Shutdown Oracle: ulimit: 25: bad number

You can then update /u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl
with #!/bin/bash to solve the problem:



Final Notes

Next up I will install the same database on a few other Linux distributions and see how it goes. Also I will write up a guide how to access the Database from anywhere. I haven’t completed that task yet so just

stay tuned.

Check Also

Muse 5 and Rio 3 —Delightful Double dose in Wireless Earphone Technology

Muse 5 and Rio 3—Delightful Double dose in Wireless Earphone Technology

The Muse 5 and Rio 3 are advanced wireless earphones with 3D audio processing designed …


  1. I dont undestand 8 step:

    “Add following lines to /var/lib/oracle/.profile”

    how can i open that .profile to add the following lines?

    if [ “$USER” = oracle ]; then
    if [ $SHELL = “/bin/ksh” ]; then
    ulimit -p 16384
    ulimit -n 65536
    ulimit -u 16384 -n 65536
    umask 022
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
    export ORACLE_SID=AL32UTF8
    export NLS_LANG=.AL32UTF8
    unset TNS_ADMIN
    if [ -d “$ORACLE_HOME/bin” ]; then

    • Hi,

      use the cat command:

      cat – >> /var/lib/oracle/.profile

      then copy and paste it all in there and finish by pressing CTRL+D

  2. Thanks for this great step guide. The screenshots help and the sed commands are awesome timesavers.

    I installed on 32-bit so I had some additional issues but was able to find solutions to them elsewhere.

    • great stuff Ken, I have not tried a 32bit installation yet but sure there are many still who run them. If you feel the need to combine your experience in one post because the other guides are all shattered over the net let me know maybe we can collaborate on it.

  3. First, excellent guide. But I have a problem that I can not solve, this is the point 11, after the judgment:

    cd / var / lib / oracle / database &&. / runInstaller

    Always get the same error, and I can not solve:

    / var / lib / oracle / database / install / .oui: 2: / var / lib / oracle / database / install / .oui: Syntax error: “)” unexpected

    I hope your help, thank you very much

    • Hello Marta,

      yea that is a formatting issue caused by wordpress. You see there “& a m p ; & a m p”
      and that is of course no Unix syntax. What it should say is “& &” (no spaces) so either replace it or
      just “cd” into the directory and execute the Installer:

      cd /var/lib/oracle/database

      The way I described is just a one liner for lazy geeks like myself :)

      • Hello,

        Thank you very much for answering so fast. I followed your steps, but I still have the same problem. I have done the following:

        oracle@marta-VirtualBox:/home/marta$ cd /var/lib/oracle/database
        oracle@marta-VirtualBox:~/database$ ./runInstaller
        /var/lib/oracle/database/install/.oui: 2: /var/lib/oracle/database/install/.oui: Syntax error: “)” unexpected

      • Hi,

        well if you have followed the Guide Step by Step you should not be getting this error, so this could be caused by one of the following reasons:

        1. you downloaded the wrong version
        did you download the 64bit version and your pc is 32bit?
        or vise versa?

        2. if the above is not the case, then re download it because
        the installer might have been corrupt, to be sure check the

        3. make sure the permissions are all good, it has to be
        executed by the User oracle.

        let me know how it goes

      • Hi,

        I’ve fixed the error, was installing the wrong version, ainsss
        But now I have a new bug to track back all the steps are as follows:

        Comprobando el monitor: debe estar configurado para mostrar al menos 256 colores
        >>> No se ha podido ejecutar la comprobación automática de colores de visualización con el comando /usr/bin/xdpyinfo. Compruebe si está definida la variable DISPLAY. Fallo


      • Hi,

        please read my previous Post that should help you explain what you need to do. It depends on what base system you are using.
        Check that you have done all this, and exporting the Display should work.


        Also remember to export the Display on the VM before you start the installer, and make sure you do that as “root”.

  4. Hello,

    Thank you very much for everything, finally I could install it!

    Now, I have a new problem. The next day I tried to access the manager of the database and gives me error.


    So I pulled back the oracle as follows:

    root@marta-VirtualBox:/home/marta# /etc/init.d/oracledb start
    Starting Oracle:
    LSNRCTL for Linux: Version – Production on 13-JUN-2012 22:22:40

    Copyright (c) 1991, 2009, Oracle. All rights reserved.

    TNS-01106: Listener using listener name LISTENER has already been started
    Processing Database instance “orcl”: log file /u01/app/oracle/product/11.2.0/dbhome_1/startup.log
    Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

    Thank you very much

    • Hi,

      thats because you must have forgotten to check your hostname or host file entry. Log in as root and check the hosts file:
      vi /etc/hosts
      and it should look like this: localhost.localdomain localhost
      next check hostnames:
      vi /etc/hostname
      and that should look like this:
      if not the case, correct it. Also when you try to logon to the manager from another PC use the IP address instead of localhost.

  5. wow, thanks ..! its works

  6. Hi,
    this is an (almost) perfect step-by-step guide. I had to include a symlink

    ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1

    for making the build/link process run without errors.
    Thanks a lot.

  7. In [Specify Installation Location] – the default settings should be as below:

    I am getting error:
    [INS-32012] Unable to create directory:

    Kindly help

  8. Hi lightao,
    execute: ulimit -n
    if the result is still 1028 then you missed the step above at “cat – >> /etc/security/limits.conf”
    check it and add the required limits in the conf. file.

  9. Hi
    I don’t use a virtual machine. I just install ubuntu 12.10 as a second OS. And the second thing is I am not very familiar with linux. So I just want to install oracle 11gr2 enterprise edition on my ubuntu which is not on a virtual machine. could you help me pls?
    thank you

  10. In the section Special note for Ubuntu 12.04: If you face error during installation so update as below:” you say to click “Continue” after executing the sed commands. You should say click “Retry”. Clicking continue will not link the emagent correctly.

  11. Great post. I got Oracle installed and running quickly with the use of this post. I got the same issues that you posted along the way and was able to correct them with your solutions. Thank you for the great write-up.

  12. psychic readings online for free

    Nice nісhе site. Greаt blog short articlе regardіng Instаlling Oгаcle 11gR2 on Ubuntu 12.
    04 | gizmojunkее. You actually posseѕs thе strаtegy for fulfillment going оn at thіs ρoint.
    I mοst сeгtainlу ωill save yоur ρagе and cоmе once again аfterωаrdѕ.

  13. awsome work man, I followed the steps given and succeccfully installed oracle 11.2 on Ubuntu 12.04. Thanks a lot.

  14. I have been browsing on-line greater than 3 hours lately, but I never
    found any fascinating article like yours. It is lovely value
    enough for me. In my opinion, if all web owners
    and bloggers made just right content material as you did, the web can be
    much more helpful than ever before.

  15. Thanks so much . . :) . . i am very happy after fighting form last 2 days . .

    You did a great job here . :) . .

    Every thing is fine with my installations but my

    “Unable to connect
    Firefox can’t establish a connection to the server at ubuntu.ubuntu-domain:1158. ”

    But my SQLPLUS is working great .