Note: This post originally appeared on The Pythian Group blog.

I recently reformatted my laptop with the latest Ubuntu LTS release, 10.04, aka Lucid Lynx. Since I like to have a native client installation as well as a portable sandbox server, I decided to install the latest version of Oracle EE, 11.2.0.1.

Rather than re-invent the wheel, I'm going to direct you to the previous Oracle-on-Ubuntu post by my colleague Augusto Bott. Many of the directions there hold true here (even with 32-bit vs 64-bit), with a few exceptions.

Download the Software

First and foremost, download the 32-or-64-bit installer files (there are 2 of them) from OTN.

Installing Pre-requisite Packages

Install these software packages on your Ubuntu 10.04 system:

$ sudo apt-get install unzip build-essential x11-utils rpm ksh lsb-rpm libaio1

Ubuntu 10.04 comes with libstdc++6 installed. However, Oracle 11gR2 requires libstdc++5. If you do not install libstdc++5, you will see errors as described in this OTN thread. The fix, as described in that thread, is to download and manually shoehorn the libstdc++5 library files onto Ubuntu 10.04:

$ wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_amd64.deb 
$ dpkg-deb -x libstdc++5_3.3.6-17ubuntu1_amd64.deb ia64-libs 
$ sudo cp ia64-libs/usr/lib/libstdc++.so.5.0.7 /usr/lib64/ $ cd /usr/lib64/ 
$ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5 
$ wget http://security.ubuntu.com/ubuntu/pool/universe/i/ia32-libs/ia32-libs_2.7ubuntu6.1_amd64.deb 
$ dpkg-deb -x ia32-libs_2.7ubuntu6.1_amd64.deb ia32-libs 
$ sudo cp ia32-libs/usr/lib32/libstdc++.so.5.0.7 /usr/lib32/ 
$ cd /usr/lib32 $ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

Now we're ready to move on.

Create User and Groups

First create the oinstall and dba groups:

$ sudo su - # addgroup oinstall # addgroup dba

Then create the oracle user and assign it to those groups:

# useradd -g oinstall -G dba -d /home/oracle -s /bin/bash oracle
# passwd oracle
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
# mkdir /home/oracle 
# chown -R oracle:dba /home/oracle

Now we create some symbolic links to give the Ubuntu system a more "Red Hat-ish layout," as Augusto put it:

# ln -s /usr/bin/awk /bin/awk 
# ln -s /usr/bin/rpm /bin/rpm 
# ln -s /usr/bin/basename /bin/basename
# mkdir /etc/rc.d 
# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done 
# mkdir -p /u01/app/oracle 
# chown -R oracle:dba /u01

Then we update some sysctl parameters by editing /etc/sysctl.conf. It is wisest to backup this file first and then add these lines to the end of /etc/sysctl.conf:

fs.file-max = 6815744 
fs.aio-max-nr = 1048576 
kernel.shmall = 2097152
kernel.shmmax = 2147483648 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100 128 
net.core.rmem_default = 4194304 
net.core.rmem_max = 4194304 
net.core.wmem_default = 1048576 
net.core.wmem_max = 1048576 
net.ipv4.ip_local_port_range = 9000 65535

Note that these values are different from what was needed in 11gR1.

Now we update some limits for the oracle software owner by adding these lines to the end of /etc/security/limits.conf:

oracle soft nproc 2047 
oracle hard nproc 16383 
oracle soft nofile 1023 
oracle hard nofile 65535

Again, it is best to backup the file first.

Now we activate the new settings from /etc/sysctl.conf with this command:

# sysctl -p

You should see the new settings in the output of that command.

Unpack and Install the Software

From here we go into the directory containing our two 11gR2 database zip files. I'm using the 64-bit edition, so my files are named linux.x64_11gR2_databaseXof2.zip, where X is 1 or 2. I unzip both of these files, which creates a "database" subdirectory:

$ unzip linux.x64_11gR2_database_1of2.zip 
$ unzip linux.x64_11gR2_database_2of2.zip

Each of these commands will produce a large volume of output to the terminal as it lists each file being unpacked. Once this is done, your directory should look something like this:

$ ls -lh total 2.2G 
drwxr-xr-x 8 seiler seiler 4.0K 2009-08-20 14:34 database 
-rw-r--r-- 1 seiler seiler 1.2G 2010-03-09 11:33 linux.x64_11gR2_database_1of2.zip 
-rw-r--r-- 1 seiler seiler 1.1G 2010-03-09 12:38 linux.x64_11gR2_database_2of2.zip

Now you simply cd into the database directory and run the runInstaller program:

$ cd database 
$ ./runInstaller

This will launch the Oracle Universal Installer, or OUI, program. The rest is pretty straight forward. Since this is just a sandbox, I chose not to provide any email info and declined to receive updates. I chose to first install the software only, which went perfectly well. OUI will complain about missing packages, since it is checking for RPMs. We can safely ignore these and proceed with installation.

Once installation is done I set these variables in my bash environment:

export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 
export ORACLE_SID=orcl 
export LD_LIBRARY_PATH=$ORACLE_HOME/lib 
export PATH=$ORACLE_HOME/bin:$PATH 
export EDITOR=/usr/bin/vi

Then some quick tests to verify installation:
$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 10 23:46:42 2010

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

SQL> quit
$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch lsinventory
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

Oracle Home       : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2010-06-10_23-46-53PM.log

Patch history file: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2010-06-10_23-46-53PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.1.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

--------------------------------------------------------------------------------

OPatch succeeded.

Everything looks hunky-dory. Let's create an instance.

I launched dbca to create an Oracle 11gR2 instance. The one problem I encountered here was that, at the end of dbca prompts, the "Confirmation" dialog window was blank. Other blog posts on the internet suggested blindly clicking around until you magically hit the "OK" button, but more often than not I would hit the "Cancel" button. Turns out this is a not-so-uncommon problem with Java Swing and Gnome's visual effects. The solution for Gnome users is to disable Visual Effects in the Appearance preferences before launching dbca. If you are using a lightweight desktop environment such as LXDE, you shouldn't have this problem.

And that's that. The rest is nothing new to those who have done installations before. You can optionally configure TNS names or Listener with the netca tool, or log into your new instance and enjoy.

Special thanks to Augusto Bott for not only authoring the previous Oracle-on-Ubuntu articles but also for suggesting the Gnome Visual Effects conflict!