There are many, many links, threads, bugs and discussions related to this since oracle 11g installation is no longer breeze at it was the case with oracle 10g, at least on Ubuntu. This is my short, minimal list of things to do to have oracle running on Ubuntu 14.04 12.04.

Last updated 2014-05-01, install on 14.04
Last updated 2013-12-25, install on 12.04.3.

0. backup. If you have a previous oracle install backup your databases with expdp. Warn: move the dumps to a safe location since the apt-get remove –purge could delete them.

1. download the package

2. unzip it

<pre lang="bash">unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

3. convert it to a deb and install it

<pre lang="bash">cd Disk1
alien --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
apt-get remove --purge oracle-xe-universal #remove 10g if needed
apt-get install libaio1 #oracle needs this
dpkg -i oracle-xe_11.2.0-2_amd64.deb

(you might get a missing chkconfig error which can be ignored)
4. until now everything is simple, now the trouble begins. The main oracle problem is with the missing /dev/shm which, in 12.04 is a link to /run/shm. The fix for this is to remove the link and mount it yourself:

<pre lang="bash">rm /dev/shm
mkdir /dev/shm
mount -t tmpfs shmfs -o size=2048m /dev/shm
sysctl kernel.shmmax=1073741824 #also edit /etc/sysctl.conf and set the same value to persist the change

ln -s /usr/bin/awk /bin/awk #small fix to eliminate some errors
It might also be necessary to create /var/lock/subsys if it does not exist (created by another package).

4.1 the above changes can be integrated in /etc/init.d/oracle-xe

  • change the AWK path
  • change /var/lock/subsys with /var/lock
  • add the /dev/shm lines

The diff from the old and new files looks as following:

<pre lang="diff">53c53
< if [ -z "$AWK" ]; then AWK=/usr/bin/awk; fi
--
> if [ -z "$AWK" ]; then AWK=/bin/awk; fi
269c269
< 	touch /var/lock/listener
--
> 	touch /var/lock/subsys/listener
321c321
< 	touch /var/lock/oracle-xe
--
> 	touch /var/lock/subsys/oracle-xe
555,559d554
< 	if [ -L /dev/shm ]; then
< 	    rm -rf /dev/shm
< 	    mkdir /dev/shm
< 	    mount -t tmpfs shmfs -o size=2048m /dev/shm
< 	fi
567c562
< 			touch /var/lock/listener
--
> 			touch /var/lock/subsys/listener
582c577
< 		touch /var/lock/oracle-xe
--
> 		touch /var/lock/subsys/oracle-xe
606c601
<     if [ $RETVAL -eq 0 ] && rm -f /var/lock/listener
--
>     if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/listener
608c603
< 	rm -f /var/lock/oracle-xe
--
> 	rm -f /var/lock/subsys/oracle-xe

5. run the configure

<pre lang="bash">/etc/init.d/oracle-xe configure

There will be some errors but the process will succeed finally.

Thats it. Oracle will now run and no more:

ORA-27101: shared memory realm does not exist

Before restarting the machine add the /dev/shm related lines from point 4 to /etc/init.d/oracle-xe in the start function somewhere around line 555.

6. If you are used to apex and don’t know what an workspace is you first need to access: http://localhost:9090/apex/apex_admin and use admin/[password provided to configure script] to login

7. Env vars for oracle are:

<pre lang="bash">export ORACLE_SID=XE
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe/ #you should know already that the last / is very important
export PATH=$PATH:$ORACLE_HOME/bin

8. If you get an:

UDI-01034: operation generated ORACLE error 1034
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
UDI-00003: all allowable logon attempts failed

for impdb note that this is due to the fact that impdp no longer uses the ORACLE_SID variable. To fix just use for instance:

<pre lang="bash">impdp system@XE/blabla

… instead of

<pre lang="bash">impdp system/blabla ...

9. links:

Comments:

Cruzado -

It worked in Ubuntu 14.04 also. Thanks: really useful and straightforward.


Eduardo Rebouças -

You saved my day. Thanks.


Barry -

Worked like a charm. Thanks.


Vladimir -

really helped! thank you!


Ajmal -

Great! One of the best step-by-step procedure which I have come across, works like a charm! Kudos!!! Thanks much! ~Ajmal


Ernie -

Thanks. Great and very helpful post. One thing Under 4.1, looking at the diff file, did you mean &lt or &gt ? I thought it should be 555,559d554 > if [ -L /dev/shm ]; then > rm -rf /dev/shm > mkdir /dev/shm > mount -t tmpfs shmfs -o size=2048m /dev/shm > fi instead of 555,559d554 < if [ -L /dev/shm ]; then < rm -rf /dev/shm < mkdir /dev/shm < mount -t tmpfs shmfs -o size=2048m /dev/shm < fi


Sven K. -

Great post, thanks! Worked for me on Ubuntu 14.04. Saved me so much time!