Skip to Main Content

Install Oracle 11gR2 Express Edition on Ubuntu Linux 11.04 (64-bit) Howto

Dude!May 24 2011 — edited Jul 28 2011
h2. Install Oracle 11gR2 Express Edition on Ubuntu Linux 11.04 (64-bit) Howto

Version: B
Author: Dude, 24. May 2011

The following are step by step instructions how to install Oracle 11gR2 Express Edition (Beta) under Linux Ubuntu 11.04, 64-bit.
Access to the Internet is required.

The instructions cover the following additional topics:

- Converting Red Hat based Oracle XE installer to Ubuntu.
- Work-around for missing /sbin/chkconfig tool.
- Install Oracle XE into a different directory or disk volume.
- Relocate and configure the Oracle user and default login directory.
- Uninstall, reconfigure and perform first database backup.
- Notes and web links.
- Troubleshooting

h3. A) System Setup and Prerequisites
h4. A.1. System Access

You will need terminal command line, root and system console access to perform the setup tasks.

To open a Terminal at the system console:
Menu Applications > Accessories > Terminal
The following commands will enable remote ssh login with root access:
sudo apt-get install openssh-server
sudo passwd root

ssh root@xe_server_host_name
h4. A.2. Software Prerequisites

The following is required in order to install Oracle 11gR2 XE:
sudo apt-get install alien libaio1 unixodbc
The following is not required, but it will fix backspace and arrow keys in case you prefer using the vi-editor:
sudo apt-get install vim
h4. A.3. System Swap space

Minimum swap space required is 2 GB. You can increase swap space if necessary using a swap file:
To analyze current swap space and memory configuration:
sudo cat /proc/meminfo

To install a 1 GB swapfile named swapfile in /, for example:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
(this may take a while)
sudo mkswap /swapfile
sudo swapon /swapfile
sudo cp /etc/fstab /etc/fstab.orig
sudo echo '/swapfile swap swap defaults 0 0' >> /etc/fstab

sudo swapon -a
sudo swapon -s
h4. A.4. Kernel Parameters

Oracle 11g XE requires the following additional kernel parameters:
sudo nano /etc/sysctl.d/60-oracle.conf

(Enter the following)

# Oracle 11g XE kernel parameters
net.ipv4.ip_local_port_range=9000 65000
kernel.sem=250 32000 100 128

(Save the file)

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

Verify: sudo cat /etc/sysctl.d/60-oracle.conf

Load new kernel parameters: 
sudo service procps start

sudo sysctl -q fs.file-max
-> fs.file-max = 6815744
h4. A.5. Oracle Installation Directory

The current Oracle Installation Guide uses the same directory like in previous versions: /usr/lib/oracle/xe/app/oracle/product/11.2.0/server. However, the current Beta installation uses Oracle Flexible Architecture (OFA) and installs into /u01/app/oracle/product/11.2.0/xe. Due to size limitations of Oracle XE it may not be necessary to store the installation to a specific directory or separate volume, but it is possible:

Install Oracle XE to separate disk volume:
From the system console menu: System > Administration > Disk Utility
Select "ext3" filesystem for Oracle compatibility and specify a Volume label, e.g. Oracle.
Notice the device name e.g. /dev/sdb

Get the drive UUID:
sudo blkid
e.g. /dev/sdb: UUID="d19a2d8f-da43-4802-8bdb-0703c855e23a"

Modify /etc/fstab to automatically mount the volume at system startup:
sudo cp /etc/fstab /etc/fstab.original
sudo nano /etc/fstab

(Add the following, using determined UUID, for exmple)

UUID=d19a2d8f-da43-4802-8bdb-0703c855e23a /u01 ext3 defaults,errors=remount-ro 0 1

(Save the file)

Create the mount-point, mount the new volume and set ownership and privileges:
sudo mkdir /u01
sudo mount -a
sudo chown root:root /u01
sudo chmod 755 /u01

df -h
or restart the system
You can also install Oracle XE into a specific directory:
Create a symbolic link to store the installation into an existing directory, for instance:
sudo mkdir /home/oracle-xe
sudo ln -s /home/oracle-xe /u01
h3. C) Oracle 11g XE Download and Installation
h4. C.1. Download and convert the Installer from Red Hat to Ubuntu

Please see section E.3. to download the Oracle 11gR2 XE installer.
Select the version listed for Linux x64.
sudo unzip
sudo alien --to-deb --scripts oracle-xe-11.2.0-0.5.x86_64.rpm
(This may take a while)
h4. C.2. Create a special chkconfig script

The Red Hat based installer of Oracle XE 11gR2 beta relies on +/sbin/chkconfig+, which is not used in Ubuntu. The chkconfig package available for the current version of Ubuntu produces errors and my not be safe to use. Below is a simple trick to get around the problem and install Oracle XE successfully:
Create /sbin/chconfig:
sudo nano /sbin/chkconfig

(Cut and paste the following)

# Oracle 11gR2 XE installer chkconfig hack for Debian by Dude
if [[ ! `tail -n1 $file | grep INIT` ]]; then
   echo >> $file
   echo '### BEGIN INIT INFO' >> $file
   echo '# Provides:             OracleXE' >> $file
   echo '# Required-Start:       $remote_fs $syslog' >> $file
   echo '# Required-Stop:        $remote_fs $syslog' >> $file
   echo '# Default-Start:        2 3 4 5' >> $file
   echo '# Default-Stop:         0 1 6' >> $file
   echo '# Short-Description:    Oracle 11g Express Edition' >> $file
   echo '### END INIT INFO' >> $file
update-rc.d oracle-xe defaults 80 01

(Save the file)

Set appropriate execute privileges:
chmod 755 /sbin/chkconfig
Note: You should remove the /sbin/chkconfig file after successful installation of Oracle XE.

h4. C.3. Install and configure Oracle XE
sudo dpkg --install ./oracle-xe_11.2.0-1.5_amd64.deb
/etc/init.d/oracle-xe configure
(This will take a while)

Remove the /sbin/chkconfig script, which is no longer needed.
sudo rm /sbin/chkconfig
h4. C.4. Relocate and Configure the Oracle user login

The Oracle XE installer specifies /u01/app/oracle as the login directory for the Oracle user. Although not really necessary, the following will relocate the Oracle user $HOME to a standard location and create standard /etc/skel login files:
Exit all Oracle user sessions:
sudo /etc/init.d/oracle-xe stop
sudo kill -9 `ps -ef | grep oracle | grep -v grep | awk '{print $2}'`
sudo userdel oracle
sudo useradd -s /bin/bash -G dba -g dba -m oracle
sudo passwd oracle

sudo id oracle
-> uid=1001(oracle) gid=1001(dba) groups=1001(dba)
h4. C.5. Setup Oracle environment variables

In order to use sqlplus and other tools, the Oracle account requires certain environment variables. The following will set these variables automatically at every interactive Oracle login:
sudo echo '. /u01/app/oracle/product/11.2.0/xe/bin/' >> /home/oracle/.bashrc
h4. C.6. Oracle sudo root access

It is not essential to allow the Oracle user to use sudo, but it is convenient:
usermod -G admin oracle

id oracle
-> uid=1001(oracle) gid=1001(dba) groups=1001(dba),120(admin)
sudo su -
-> Enter Oracle account password
h4. C.7. Oracle 11g XE Post-installation

After you install Oracle Database XE, its graphical user interface is only available from the local server, but not remotely.
The following will correct the problem if necessary:
Login as user Oracle or use:
su - oracle
sqlplus / as sysdba

At the SQL prompt, enter the following command:
h3. D) Unintstall, Reconfigure and Troubleshooting
h4. D.1. Uninstall Oracle 11g XE

The following will completely uninstall and remove Oracle 11g XE:
Login as user root:
sudo su -
/etc/init.d/oracle-xe stop
dpkg --purge oracle-xe
rm -r /u01/app
rm /etc/default/oracle-xe
update-rc.d -f oracle-xe remove
h4. D.2. Reconfigure Oracle 11g XE

Type the following in a terminal window:
/etc/init.d/oracle-xe stop
sudo rm /etc/default/oracle-xe
/etc/init.d/oracle-xe configure
h4. D.3. Enable Archivelog mode and perform a database backup
Login as user Oracle:
su - oracle
sqlplus / as sysdba

At the SQL prompt, enter the following commands:
shutdown immediate
startup mount
alter database archivelog;
alter database open;

Login to system console of the Oracle user account:
Select Applications > Oracle Database 11g Express Edition > Backup Database
h3. E) Notes
h4. E.1. Oracle 11g XE limitiations overview

- It will consume, at most, processing resources equivalent to one CPU.
- Only one installation of Oracle Database XE can be performed on a single computer.
- The maximum amount of user data in an Oracle Database XE database cannot exceed 11 GB.
- The maximum amount of RAM that Oracle XE uses cannot exceed 1 GB, even if more is available.
- HTTPS is not supported natively with the HTTP listener built into Oracle Database XE.

h4. E.2. Documentation and Links

Official documentation for Oracle 11gR2 XE can be found at:

h4. E.3. Oracle 11g XE downloads

The Installer is available from the Oracle Technology Network at:

h4. E.4 APEX links and archives

The APEX archives can be found at:
The APEX download site is:

h3. F) Troubleshooting

... in progress

Regards and best of luck!

Edited by: Dude on May 25, Version B: various corrections. chkconfig package (A.2.) not required.
Post Details
Added on May 24 2011