How to Install Oracle 11g on Ubuntu Linux: Complete Guide

Oracle Database is a reliable multiplatform database management software developed by Oracle Corporation. It offers a set of advantages, which include high performance, wide functionality, clusters support, PL/SQL support etc. Oracle Database (will be referred to as Oracle in this blog post) can be installed on Solaris, Windows and Linux. Installation on Windows is the easiest option while installing Oracle on Solaris and Linux needs manual pre-installation configuration. As for Linux distributions, Oracle recommends to install Oracle database on Red-Hat, Oracle Linux, and SUSE Linux Enterprise Server.

However, you can install Oracle on Ubuntu Linux and Open SUSE Linux as well. Ubuntu is a popular Linux distribution that is widely used in the world and today’s blog post provides step-by-step instructions of how to install Oracle on Ubuntu. In this tutorial, we will install Oracle database Enterprise Edition (EE) 11g R2 on Ubuntu.

NAKIVO for Linux Machines Backup

NAKIVO for Linux Machines Backup

Fast and efficient backup for Linux servers and workstations. Anti-ransomware protection, multiple backup targets, flexible recovery options and much more!

Preparing Ubuntu Linux

In this tutorial, a freshly installed Ubuntu 16.04.6 is used. The operating system was installed on the VMware VM without enabling the “Download updates while installing Ubuntu” option and without using the “Install third-party software” option during OS deployment.

If you have never installed Oracle on Linux before, you should learn how to install Oracle on Ubuntu on a virtual machine before installing Oracle on a physical computer or a server.

If you use a VMware VM, don’t forget to install VMware Tools. You can also use VirtualBox and Hyper-V virtual machines.

Make sure that you have selected the correct time zone during installation. The time zone is GMT 0 (London) in this example.

You can check the time zone with the command:


Check the Ubuntu version:

lsb_release -a

The output is the following in our example:

Installing Oracle database on Ubuntu 16 – checking the version of Ubuntu

In this tutorial about how to install Oracle 11g on Ubuntu, the following VM hardware parameters are used:

  • CPU: 1 CPU
  • RAM: 4 GB
  • Hard disk drive: 40 GB

user1 is a regular user in this example (user1 is created during Ubuntu installation and is used to log into Ubuntu).

The following packages are installed:

  • vim, the text editor
  • net-tools, tools for network management
  • openssh-server, the SSH server that allows you to connect to the Linux console (terminal) remotely

If you don’t have these packages installed in your Ubuntu Linux, you can install them by using the command:

sudo apt-get install -y vim net-tools openssh-server

The SSH server is installed for convenience. You should run many commands in the console before using the Oracle installer on Ubuntu.

In order to enable authentication by using passwords, edit the sshd_config file:

vim /etc/ssh/sshd_config

Uncomment the line (remove “#” at the beginning of a line):

PasswordAuthentication yes

Save changes and quit by pressing the Esc key in vim and typing :wq

Restart the sshd service (daemon), by running the command with root privileges:

sudo service ssh restart

Configuring a Swap File

Ubuntu 16 uses a swap partition by default. You can customize the size of the swap partition when installing Ubuntu. If you have selected the default partitioning options or selected the incorrect size of the swap partition, you can still create a swap file of the custom size and use the swap file instead of an existing swap partition. The swap size should be equal to twice the RAM size. If you are going to install Oracle on Ubuntu with 4 GB of RAM, you should prepare a swap file or partition that is 8 GB. Let’s create the 8-GB swap file.

Temporary disable using the swap area:

sudo swapoff -a

Create a new 8-GB file with the dd tool:

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

Set the created 8-GB file to be used as a swap file:

sudo mkswap /swapfile

Enable using swap again:

sudo swapon /swapfile

Check the size of your swap area after creating a new swap file:

grep SwapTotal /proc/meminfo

Configuring Network Settings

By default, Ubuntu 16 obtains an IP address automatically for a network interface (if a DHCP server is present in the network). You need to set a static IP address and configure a hostname before you can install Oracle on Ubuntu.

Check the current IP configuration:


In the output, you can see the names of your network adapters and IP addresses. In our case, the name of the needed network interface is ens33.

Configuring the static IP address

Edit the network interfaces configuration file with vim:

sudo vim /etc/network interfaces

The static IP address needed for installing Oracle database on Ubuntu is on the current interface of the Linux machine in this example. Edit the configuration file as follows:

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback

auto ens33

iface ens33 inet static





Save changes and quit.

Apply the changes:

sudo /etc/init.d/networking restart

Or reboot the machine:

init 6

Verify that the new IP settings are applied:



hostname -I

After checking the IP address configuration, check the hostname.

Checking the hostname

In our case, the hostname used for installing Oracle on Ubuntu is ubuntu-oracle11.

Check the current hostname:


If you have forgotten to configure the hostname during the installation of Ubuntu or want to change the hostname for other reasons, you can still do it.

In order to rename the host and set a new hostname (ubuntu-oracle11), run the command:

sudo hostnamectl set-hostname ubuntu-oracle11

Verify whether the new host name is applied:

less /etc/hostname

Edit the hosts file:

sudo vim /etc/hosts

The contents of the /etc/hosts file must look like this: localhost ubuntu-oracle11

Restart the machine:

init 6

Try to ping the defined hostname on your Ubuntu machine:

ping ubuntu-oracle11

Configuring the environment for Oracle

To install Oracle on Ubuntu, you need to configure the Linux environment: create system users and groups, configure kernel parameters, set up a system profile, set environment variables for a user, define shell limits, create symlinks, and install required packages.

Creating users and groups

Open the local console or connect to the Linux console via SSH as a regular user and then get the root privileges:

sudo -i

The below commands must be executed as root.

Add the groups required by Oracle.

Create the Oracle Inventory group:

groupadd oinstall

Create the Oracle DBA group:

groupadd dba

Create the home directory for the Oracle user:

mkdir /home/oracle/

Create the directory for installing Oracle:

mkdir -p /u01/app/oracle

Then create the Oracle user account that is a member of the dba group, has the /home/oracle/ home directory and uses /bin/bash as the default shell:

useradd -g oinstall -G dba -d /home/oracle -s /bin/bash oracle

Set the password for the oracle user (don’t forget this password):

passwd oracle

Set the oracle user as the owner of the Oracle home directory and Oracle installation directory. The oracle user is a member of the oinstall group.

chown -R oracle:oinstall /home/oracle

chown -R oracle:oinstall /u01/app/oracle

Note: Unlike Oracle 10, creating the nobody group is not needed for Oracle 11.

Create the directory for Oracle Inventory:

mkdir -p /u01/app/oraInventory

Set the oracle user as the owner for the Oracle Inventory directory:

chown -R oracle:oinstall /u01/app/oraInventory

Configuring kernel parameters

Custom kernel parameters are required to install Oracle on Ubuntu and these kernel parameters affect Oracle performance. Shared memory parameters, including minimum and maximum size, the number of shared memory segments, and semaphores that can be considered as flags for shared memory must be customized according to the Oracle documentation. You also need to set the maximum allowed number of files that can be opened at once, the maximum number of simultaneous network connections, the size of network send and receive buffer. The considered kernel parameters can be categorized in three groups: kernel specifics (kernel), network specifics (network), and file handlers (fs). Edit the /etc/sysctl.conf file to override the parameters of the Linux kernel:

vim /etc/sysctl.conf

Append the lines shown below to the end of this configuration file.

# ============================

# Oracle 11g

# ============================

# semaphores: semmsl, semmns, semopm, semmni

kernel.sem = 250 32000 100 128

kernel.shmall = 2097152

kernel.shmmni = 4096

# Replace kernel.shmmax with the half of your memory size in bytes

# if lower than 4 GB minus 1

# 2147483648 is 2 GigaBytes (4 GB of RAM / 2)



# Max number of network connections. Use sysctl -a | grep ip_local_port_range to check.

net.ipv4.ip_local_port_range = 9000  65500


net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576


# The maximum allowed value, set to avoid overhead and input/output errors

fs.aio-max-nr = 1048576

# 512 * Processes

fs.file-max = 6815744

fs.suid_dumpable = 1


# To allow dba to allocate hugetlbfs pages

# 1001 is your oinstall group, you can check this id with the grep oinstall /etc/group command

vm.hugetlb_shm_group = 1001

Apply the kernel parameters you have set:

sysctl -p

Configuring shell limits

You have to set shell limits to improve performance of the Oracle database software.

Edit the /etc/security/limits.conf file:

vim /etc/security/limits.conf

Add the following lines to the end of the configuration file:

# Oracle

oracle           soft    nproc   2047

oracle           hard    nproc   16384

oracle           soft    nofile  1024

oracle           hard    nofile  65536

oracle           soft    stack   10240

The first column specifies the user for whom the limits are set.

The second column operates with two options—soft and hard. Soft is the maximum number that can be set by the user, while hard is the maximum number that can be reconfigured by the defined user (oracle). If the oracle user reaches the critical low value of 2047 set in the first line and needs to extend the limit, the user can increase the limit to 16384. Values higher than 16384 cannot be set by the oracle user but can be set by root.

The third column defines on which resources the set limits are applied.

The fourth column defines the maximum number of the resource parameter specified in the third column.

PAM configuration

Ensure that the /etc/pam.d/login configuration file contains the following line:

session    required

You can do it with the command:

cat /etc/pam.d/login | grep

If the mentioned line is missing, add this line manually.

Setting the shell profile

System wide environmental variables are set in the global bash shell profile that is set in the /etc/profile configuration file.

Edit /etc/profile and set some needed parameters for oracle globally and permanently:

vim /etc/profile

Add the following lines:

if [ $USER = “oracle” ]; then

        if [ $SHELL = “/bin/ksh” ]; then

              ulimit -p 16384

              ulimit -n 65536


              ulimit -u 16384 -n 65536



Note: It is useful to know when each shell configuration file can be used because later you will need to configure a profile that contains environment variables for the oracle user.

Bash login shell loads its configuration from the following files in the appropriate order:

  1. /etc/profile
  2. ~/.bash_profile
  3. ~/.bash_login
  4. ~/.profile

/etc/profile can be considered as a global profile for the bash login shell.

./bash_profile is applied for bash login shells, for example, when you log into the command line interface of Linux directly by using a keyboard connected to this Linux computer, or when opening a new console session after you log in by using the SSH terminal.

.profile – this file is read for bash and other shells like sh.

Bash non-login interactive shell loads configuration from ~/.bashrc

It means that if you are already logged into your Linux machine (for example you have logged into Ubuntu with GUI) and then opened a new console (terminal) window, then shell configuration, including environment variables, is loaded from the .bashrc file before you get access to the command prompt.

Bash non-login and non-interactive shell loads configuration that is set in the $BASH_ENV environment variable. The non-login and non-interactive shell is used when a script runs.

Installing the required packages

You need to install packages required by Oracle. Take care when installing them because a missing package may cause errors during Oracle installation or database creation.

Update the repository tree:

apt-get update

Install packages to avoid errors that can occur during the installation of Oracle on Ubuntu. Most packages can be installed with Ubuntu standard package manager from online repositories.

apt-get install alien

apt-get install autoconf

apt-get install automake

apt-get install autotools-dev

apt-get install binutils

apt-get install bzip2

apt-get install doxygen

apt-get install elfutils

apt-get install expat

apt-get install gawk

apt-get install gcc

apt-get install gcc-multilib

apt-get install g++-multilib

apt-get install libelf-dev

apt-get install libltdl-dev

apt-get install libodbcinstq4-1 libodbcinstq4-1:i386

apt-get install libpth-dev

apt-get install libpthread-stubs0-dev

apt-get install libstdc++5

apt-get install make

apt-get install openssh-server

apt-get install rlwrap

apt-get install rpm

apt-get install sysstat

apt-get install unixodbc

apt-get install unixodbc-dev

apt-get install unzip

apt-get install x11-utils

apt-get install zlibc

apt-get install libaio1

apt-get install libaio-dev

There are a few packages left to install, but to install them you’ll need these tips and tricks.

apt-get install ia32-libs

When you run the command to install this package with apt-get, you will see a message saying that this package is not available.

There is an alternative package that can be installed instead of ia32-libs. Install the lib32z1 alternative package:

apt-get install lib32z1

Let’s install the next package:

apt-get install libmotif4

This package is also not available. You should download and install this package manually. Download the libmotif4_2.3.4-8ubuntu1_amd64.deb file from a free resource. Save the downloaded deb file to a custom directory, for example, /home/user1/Downloads, before you can install this package.

The workflow of installing deb packages in Ubuntu is the following (execute commands with root privileges):

sudo dpkg -i package_name.deb

sudo apt-get -f install

In this case, we run the commands for installing packages as a regular user, for example, user1 by using sudo. Press Ctrl+D to exit the root session and to turn back to the user1 session in the console (terminal).

Go to the directory where the downloaded files are stored:

cd /home/user1/Downloads

Download the file by using a direct link:


sudo dpkg -i libmotif4_2.3.4-8ubuntu1_amd64.deb

sudo apt-get -f install

The next package cannot be installed automatically:

sudo apt-get install libpthread-stubs0

E: Unable to locate package libpthread-stubs0

Download and install this package manually.


sudo dpkg -i libpthread-stubs0-dev_0.3-4_amd64.deb

sudo apt-get -f install

Similarly install the next package:

sudo apt-get install lsb-cxx

E: Unable to locate package lsb-cxx

You can download the lsb-cxx package manually.


sudo dpkg -i lsb-cxx_4.1+Debian11ubuntu6mint1_amd64.deb

sudo apt-get -f install

Install one more package:

sudo apt-get install pdksh

E: Package ‘pdksh’ has no installation candidate

The workflow for installing the pdksh package is the same. This package can be downloaded here.


sudo dpkg -i pdksh_50e-2ubuntu1_all.deb

sudo apt-get -f install

Oracle 11g requires the installation of the 32-bit version of the libstdc++5 package that is not installed on Ubuntu 16 automatically. Here’s how you can install this package manually.

The next commands are executed as root. Create a temporary directory to download the package:

mkdir /tmp/libstdc++5

cd /tmp/libstdc++5

Download the package (links to the 32-bit and 64-bit packages are shown):



Install the downloaded packages with dpkg:

dpkg –force-architecture -i libstdc++5_3.3.6-30_i386.deb

Note: If links don’t work, newer versions of packages can be published instead of older versions. In this case, visit a web page in the browser and copy the correct links to the needed deb packages:

Reboot the Linux machine to apply the changes.

init 6

Creating symbolic links

You have to create symbolic links (symlinks) to make the file and directory structure used in Ubuntu similar to the file structure in Red Hat. Create the symlinks to make a file system structure appear identical to the Red Hat file system structure to prevent errors during Oracle installation.

Run commands as root:

mkdir /usr/lib64

ln -s /etc /etc/rc.d

ln -s /usr/bin/awk /bin/awk

ln -s /usr/bin/basename /bin/basename

ln -s /usr/bin/rpm /bin/rpm

ln -s /lib/x86_64-linux-gnu/ /usr/lib64/

ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/

ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/

ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib64/

ln -s /usr/lib/x86_64-linux-gnu /usr/lib64

ln -sf /bin/bash /bin/sh

ln -s /etc/rc0.d /etc/rc.d/rc0.d

ln -s /etc/rc2.d /etc/rc.d/rc2.d

ln -s /etc/rc3.d /etc/rc.d/rc3.d

ln -s /etc/rc4.d /etc/rc.d/rc4.d

ln -s /etc/rc5.d /etc/rc.d/rc5.d

ln -s /etc/rc6.d /etc/rc.d/rc6.d

ln -s /etc/init.d /etc/rc.d/init.d

The above commands help prevent errors, such as:

  • genclntsh: Failed to link in make file for rdbms/lib/ because of missing library: /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a inside
  • lib// undefined reference to `nnfyboot’ in make: rdbms/lib/dg4odbc] Error 1

Now let’s prevent one more error: /lib64/ File or directory does not exist, while creating lib/ in Go to the /lib64 directory and execute the command:

cd /lib64

ln -s /lib/x86_64-linux-gnu/ .

Don’t miss the dot at the end of the command.

Set the Linux version as Red Hat Linux release 5 in /etc/redhat-release. Red Hat Linux distributions store their version in that file.

echo ‘Red Hat Linux release 5’ > /etc/redhat-release

Configuring the oracle user profile

Now you need to configure the user environment for the oracle user.

Login as oracle if you have opened the console as another user:

su oracle

Run the commands as oracle:


vim ~/.bashrc

Add the following lines to the .bashrc file:

# Oracle Settings

TMP=/tmp; export TMP


# Enter your hostname



ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME


PATH=/usr/sbin:$PATH; export PATH


LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH


umask 022

Apply the settings:

source ~/.bashrc

You should restart Ubuntu now. Note that settings will be applied after reboot even without running source ~/.bashrc.

init 6

Preparing the Oracle Installer

We’re almost done with the preparations for installing Oracle. There’s just a few more steps before you can start the installer and install Oracle on Ubuntu. After rebooting the Ubuntu machine, log in as oracle in the graphical user interface of Ubuntu.

Log in as oracle before you can run the installer and install Oracle on Ubuntu

Open a web browser.

In our example, two downloaded files are saved to /home/oracle/Downloads for convenience:

Installing Oracle database on Ubuntu 16 – two Oracle installation archives are downloaded

Open the console in Ubuntu and run the following commands as oracle. Go to the directory where the downloaded files are stored:

cd /home/oracle/Downloads

or cd ~/Downloads/

Unzip installation files from the downloaded zip archives:



The extracted files are stored in:


Now you are ready to run the installer and install Oracle on Ubuntu.

Installing Oracle

Go to the directory to which the installation files were downloaded. Run commands as oracle in the console started in the GUI session.

cd /home/oracle/Downloads/database

Run the Oracle installer:


Installing Oracle database on Ubuntu – running the Oracle installer

1. Configure Security Updates

Untick the “I wish to receive security updates via My Oracle Support” checkbox.

Click Next to go to the next step of the Oracle installation wizard.

How to install Oracle on Ubuntu – Oracle Universal installer is launched

You will see the message: You have not provided an email address. Do you wish to remain uninformed of critical security issues in your configuration? Ignore this message and hit Yes.

Installing Oracle database on Ubuntu – an email address is not necessary

2. Installation Option

Select Create and configure a database.

How to install Oracle on Ubuntu – create and configure a database

3. System Class

Select Server Class, which is an advanced option for installing Oracle database on Ubuntu.

Select a server class when you install Oracle on Ubuntu

4. Grid Options

Select Single instance database installation as the type of database installation.

Installing Oracle database on Ubuntu – single instance database installation

5. Install type

Select Advanced install as the installation type. This option allows you to set passwords, character sets, languages, storage options, etc.

Select Advanced install when you install Oracle on Ubuntu Linux

6. Product Languages

Select the needed languages. In this example, English and English (United Kingdom) are selected.

You can select needed languages when you install Oracle 11g on Ubuntu

7. Database Edition

Select Enterprise Edition for a database that you are going to install.

How to install Oracle 11g on Ubuntu – installing Oracle Enterprise edition

8. Select Oracle base location

Usually the Oracle base directory and Oracle home directory are used.

Oracle Base: /u01/app/oracle

Software location: /u01/app/oracle/product/11.2.0/dbhome_1

Select the installation location to install Oracle on Ubuntu

9. Create Inventory

The directory that is used to store Oracle installation files is called the “Oracle inventory directory”.

Inventory Directory: /u01/app/oraInventory

oraInventory Group name: oinstall

Installing Oracle database on Ubuntu – selecting the Oracle Inventory directory

10. Configuration Type

Select the type of the database you want to create:

General Purpose / Transaction Processing

Selecting the database type for general purpose use

11. Database Identifiers

You can define the same value for a global database name and Oracle Service Identifier.

Global database name: ORADB11G

Oracle Service Identifier (SID): ORADB11G

Setting a global database name and Oracle Service Identifier

12. Configuration options

There are four tabs in this step. You can set the configuration on each tab as follows:

Memory: Enable Automatic Memory Management (default).

Character sets: Use Unicode (AL32UTF8).

Security: Assert all new security settings (default).

Sample schemas: Create database with sample schemas (however, you can leave the default value).

Configuration options that are used to install Oracle 11g on Ubuntu

13. Management options

You can leave the default parameters.

Configuring Management options to install Oracle 11g on Ubuntu

14. Database storage

Read the recommendations displayed in the window and select File system.

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

Selecting a database file location on a file system to install Oracle 11g on Ubuntu

15. Backup and Recovery

At this point you can select the option: Do not enable automated backups (default).

Backups are important, but it is better to configure Oracle database backups after you install Oracle on Ubuntu.

Oracle backup can be configured after installing Oracle database on Ubuntu

16. Schema passwords

You can select Use the same password for all accounts. Enter a password and confirm the password.

Select schema passwords to install Oracle on Ubuntu

17. Operating System Groups

Read the description shown in the window and select the required groups.

Database Administrator (OSDBA) Group: dba

Database Operator (OSOPER) Group: oinstall

Selecting operating system groups to install Oracle on Ubuntu

18. Prerequisite checks

Now the Oracle installer checks whether system configuration meets the prerequisites. Warnings will appear for this step. The OS Kernel Parameter semmni was configured above, but the failed status is displayed for this parameter.

OS Kernel Parameter: semmni Failed

Running prerequisite checks before installing Oracle database on Ubuntu

You can check this parameter value to check that everything is correct. Check the semmni parameter with the command (run as root):

/sbin/sysctl -a | grep sem

kernel.sem = 250        32000   100     128


cat /proc/sys/kernel/sem

250     32000   100     128

If the last value is no less than 128, then everything is OK, and you can ignore this warning.

How to install Oracle on Ubuntu – checking the semmni kernel parameter

For some reason, Oracle prerequisite checker cannot determine that the semmni parameter is correct and the required packages are installed. If the content of your Prerequisite Checks window is similar to the window displayed on the screenshot above, tick the Ignore All checkbox and click Next to continue.

19. Summary

Check the configuration summary to make sure that you have configured all settings as needed. You can save the response file (db.rsp) as it may come in handy when you need to install Oracle on multiple Linux machines or if you are going to install Oracle on Ubuntu Server without the GUI.

Checking Oracle configuration summary

Now you can monitor how the Oracle installer is copying files until the installer proceeds to the Link binaries stage.

Linking binaries for Oracle—fixing linking and compilation errors

This stage is one of the most difficult stages of installing Oracle database on Ubuntu Linux. The probability of getting errors on this step is high. In the current example, the following error is encountered when we install Oracle 11g on Ubuntu 16:

Error in invoking target ‘install’ of makefile ‘/u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/’. See ‘/u01/app/oraInventory/logs/installActions2020-01-22_12-53-06PM.log’ for details.

Notice that similar errors can occur even if you install Oracle on Oracle Linux. The name of your log file should be different.

Note: Files with .mk extension are makefiles and are used to compile programs. A makefile determines which “pieces” of program to compile and which files of the program must be compiled and linked together. Some components of Oracle software are written in Java (for example, Oracle Universal Installer that has a GUI) and some components are written on C. The components written on Java must be interpreted without compiling (Java is multiplatform), whereas the components written on C must be compiled and linking binaries and libraries is the required stage of this process. Oracle uses this approach to add more flexibility and allow the installation of Oracle on different operating systems (Windows, Linux, Solaris). Another benefit is the reduced size of the installer. The disadvantage is that errors may occur in the linking binaries stage during the installation process of Oracle. In most cases, you should add the appropriate flags by editing .mk files to fix linking issues.

Error in invoking target install of makefile can occur when you install Oracle on Ubuntu

Let’s find out how to fix link binaries errors that occur when installing Oracle database on Ubuntu Linux.

Login as oracle via SSH to the Ubuntu machine and check the log file:

tail -n 100 /u01/app/oraInventory/logs/installActions2020-01-22_12-53-06PM.log

Checking the log file to fix the error in invoking target install of makefile

When you read the log output, pay attention to the line that explains the error.

INFO: /u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/ recipe for target ‘ctxhx’ failed refers you to the line 11 of the file.

Let’s open the file and check line 11 of that file.

vim /u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/

In the navigation mode of vim type :set number to see the line numbers.

Viewing the file in vim to fix the Oracle installation error

Let’s find line number 11.

Finding the needed line in the file to fix the Oracle installation error in Ubuntu

When using the navigation mode in vim, you can find the needed string with the command:


Edit the following section:

ctxhx: $(CTXHXOBJ)


Line number 11 must be edited as follows:

-static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/stdc.a

Fixing the error in invoking target install of makefile when installing Oracle database on Ubuntu

Save the and quit vim.

Now go back to the Oracle installation error window and click Retry.

The installation process continues, but in a few seconds another error is displayed when Building Agent Libraries:

Error in invoking target ‘agent nmhs’ of makefile ‘/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/’.

Error in invoking target agent nmhs of makefile

Run the following commands as oracle to fix this issue:

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

sed -i ‘s/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g’ $ORACLE_HOME/sysman/lib/

Note: sed is a stream text editor that is used to save time of editing the .mk files comparing to editing them with vim or other interactive text editors.

After running the above two commands, click Retry in the Oracle installation error window. You can see that the error is fixed and installing Oracle database on Ubuntu Linux is going on. However, in a few seconds another error occurs when Linking RDBMS Executables:

Error in invoking target ‘all_no_orcl’ of makefile ‘/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/’.

Error in invoking target all_no_orcl of makefile

Run the following commands as oracle to fix this error and a few other similar errors:

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1


ln -s libclient11.a libagtsh.a

$ORACLE_HOME/bin/genagtsh $ORACLE_HOME/lib/ 1.0

sed -i ‘s/^\(\$LD \$LD_RUNTIME\) \(\$LD_OPT\)/\1 -Wl,–no-as-needed \2/g’ $ORACLE_HOME/bin/genorasdksh

sed -i ‘s/^\(\s*\)\(\$(OCRLIBS_DEFAULT)\)/\1 -Wl,–no-as-needed \2/g’ $ORACLE_HOME/srvm/lib/

sed -i ‘s/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\)/\1 -Wl,–no-as-needed \2/g’ $ORACLE_HOME/network/lib/

sed -i ‘s/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \(\$(PL_FLAGS)\)/\1 -Wl,–no-as-needed \2/g’ $ORACLE_HOME/rdbms/lib/

Then go back to the error window and click Retry. Now the installation process should resume without errors.

Oracle Database Configuration Assistant (DBCA) will open after passing the Link binaries stage.

Installing Oracle database on Ubuntu – Oracle Database Configuration Assistant is running

Executing configuration scripts

We’re almost at the finish line of installing Oracle database on Ubuntu.

Run these two scripts as root:



How to install Oracle on Ubuntu – two scripts must be executed to finish Oracle installation

On the screenshot below you can see that the scripts have been executed successfully.Running scripts to finish installing Oracle database on Ubuntu

The installation of Oracle Database was successful.

If you see this notification, you can close the Oracle installer window.

The installation of Oracle Database was successful on Ubuntu Linux

Check that Oracle is running on Ubuntu

Open a web browser on your Ubuntu machine running Oracle and check whether Oracle is running by opening the web interface of Oracle Database Control Manager. The following links can be used to do this:



You can also try to connect to the Ubuntu machine running Oracle from another host of your network.

Define the connection parameters.

User Name: SYS

Password: Your password that has been set during Oracle installation

Connect As: SYSDBA

Database Control Manager for Oracle 11g Enterprise Edition – entering credentials

Below you can see the screenshot of the Oracle Enterprise Manager for when Oracle is running correctly.

How to install Oracle on Ubuntu - Oracle Enterprise Manager is running

Oracle post-installation configuration

Oracle is now installed, and now we should configure the database to start automatically once Ubuntu is booted. You should edit the /etc/oratab configuration file to set Oracle to start during system boot.

Run the command as root.

vim /etc/oratab

Replace N to Y at the end of the line:


Useful commands

Before setting Oracle to start automatically, you should understand how to start Oracle components manually. This will also help for diagnostics. Run these commands as oracle user.

Start the database:


Stop the database:


Start the Database Control Enterprise Manager that provides a web interface for database control:

emctl start dbconsole

Stop the Database Control Manager:

emctl stop dbconsole

Check the Database Control Manager Status:

emctl status dbconsole

Start the listener:

$ORACLE_HOME/bin/lsnrctl start

Stop the listener:

$ORACLE_HOME/bin/lsnrctl stop

Check the status of the listener:

$ORACLE_HOME/bin/lsnrctl status

Start the Database Configuration Assistant (in the GUI shell, not in the SSH cosole):


The Oracle listener can be configured by editing the file:

vim $ORACLE_HOME/network/admin/listener.ora

Connecting to the database in the console:

sqlplus / as sysdba;

Creating a startup script for Oracle in Ubuntu

Let’s explore how to set Oracle to start automatically during Ubuntu startup. After editing /etc/oratab, you should create a startup script in the /etc/init.d/ directory.

Create the new file of the Oracle startup script in Ubuntu (run the command as root):

vim /etc/init.d/oracle

Add the following content to that file:



# Run-level Startup script for the Oracle Instance and Listener



# Provides:          Oracle

# Required-Start:    $remote_fs $syslog

# Required-Stop:     $remote_fs $syslog

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: Startup/Shutdown Oracle listener and instance







# if the executables do not exist — display error

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]


echo “Oracle startup: cannot start”

exit 1


# depending on parameter — startup, shutdown, restart

# of the instance and listener or usage display

case “$1” in


# Oracle listener and instance startup

echo -n “Starting Oracle: “

echo “dbstart”

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORACLE_HOME/bin/dbstart $ORACLE_HOME”

echo “lsnrctl start”

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORACLE_HOME/bin/lsnrctl start”

#Optional : for Enterprise Manager software only

echo “emctl start dbconsole”

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORACLE_HOME/bin/emctl start dbconsole”

touch /var/lock/oracle

echo “OK – a script has been executed”



# Oracle listener and instance shutdown

echo -n “Shutdown Oracle: “

#Optional : for Enterprise Manager software only

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORAClE_HOME/bin/emctl stop dbconsole”

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORACLE_HOME/bin/lsnrctl stop”

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORACLE_HOME/bin/dbshut $ORACLE_HOME”

rm -f /var/lock/oracle

echo “OK – a script has been executed”



$0 stop

$0 start



echo “Usage: $0 start|stop|restart|reload”

exit 1


exit 0

Set the correct permissions:

chown oracle:oinstall /etc/init.d/oracle

chmod 0775 /etc/init.d/oracle

Make this script start right after operating system startup (available for default runlevels):

update-rc.d oracle defaults

You can edit the startup priority if needed.

Run the script to stop Oracle (you can run this script as root):

/etc/init.d/oracle stop

If you want to start Oracle, run this script with the command:

/etc/init.d/oracle start

How to install Oracle on Ubuntu – running a startup script for Oracle

Note: Pay attention to the following line and similar lines in the Oracle startup script:

source “/home/oracle/.bashrc” && su $ORACLE_OWNR -c “$ORACLE_HOME/bin/dbstart $ORACLE_HOME”

First we set the shell to read the settings stored in the .bashrc system profile of the oracle user including variables such as ORACLE_HOSTNAME, ORACLE_BASE, PATH etc. that are needed for Oracle components to run properly. After the bash settings of the oracle user are applied to the current shell session, the next command is executed to start Oracle database.

What is the difference between su – and su?

user1@hostname:~$ su – username2 – this command runs the command line shell session as the selected user (username2) with the settings of the selected user (username2) as if you were logged in as username2 when creating a new shell session directly (from scratch). Environment variables of username2 are used in this shell session.

user1@hostname:~$ su username2 – this command runs the command line shell as the selected user (username2) with the settings of the current user (user1) and environment variables of the user1 are inherited by username2 in this shell session.

su -c (–command) means that a specified command must be run as the selected user.


Let’s review some possible issues that may occur when you install Oracle on Ubuntu and whether there are methods to fix them.

ORA-12547: TNS:lost contact

Database Configuration Assistant cannot create a database and an error occurs.

ORA-12547: TNS:lost contact.

Log files for the current operation are located at:


How to install Oracle on Ubuntu – ORA-12547 TNS lost contact

Check the log file:

tail -n 100 /u01/app/oracle/cfgtoollogs/dbca/ORADB11G/cloneDBCreation.log

Pay attention to these strings:

oracleORADB11G: error while loading shared libraries: cannot open shared object file: No such file or directory

ORA-12547: TNS:lost contact

One of the reasons for this error message being displayed is the absence of libraries related to the appropriate packages—libaio1, libaio-dev. Check whether the mentioned packages are installed, otherwise install them:

sudo apt-get install libaio1

sudo apt-get install libaio-dev

Oracle doesn’t start automatically when Ubuntu boots

It may happen that you are running the script as root and see the message:

“Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name”.

Oracle doesn’t start automatically when Ubuntu boots in this situation. If this error message is displayed when starting Oracle Enterprise Manager 11g Database Control, then you should check environment variables.

How to check the ORACLE_UNQNAME?

You can check the ORACLE_UNQNAME (run commands as oracle).

sqlplus / as sysdba;

SQL> SELECT name, db_unique_name FROM v$database;

SQL> exit

Edit /etc/profile (as root):

vim /etc/profile

Add the line in the end of the /etc/profile file:


Restart the Ubuntu machine on which Oracle is installed.

Now this error should not appear when running the script and Oracle should start after running the /etc/init.d/oracle start command manually. However, Oracle still doesn’t start automatically during startup of Ubuntu Linux. The reason of this issue is that environment variables are not set for the shell where the script is running. See the explanation of the Oracle startup script above and go over your script carefully.

Is it possible to install Oracle 11g on Ubuntu 18?

Ubuntu 18 has newer versions of Linux system libraries that are greatly compatible with Oracle 11g R2. There’s a high probability that you will get errors on the Link Binaries stage of Oracle installation. For example:

Error in invoking target ‘links proc gen_pcscfg’ of makefile ‘ u01/app/oracle/product/11.2.0/dbhome_1/precomp/lib/ ‘.

How to install Oracle 11g on Ubuntu 18 – Error in invoking target links proc gen_pcscfg of makefile

That’s why Ubuntu 16 is used in this tutorial. Of course, you can try to install Oracle 11g on Ubuntu 18 but be prepared for some difficulties. You may need to install packages and libraries of the older versions and, thereby downgrading the Ubuntu operating system.

The workflow of installing Oracle database on Ubuntu 18 is similar to installing Oracle database on Ubuntu 16 (for Oracle 11g R2 EE). In the Link Binaries stage when errors occur, you should analyze logs, research the documentation, and fix linking errors.

The following command may be useful for manually relinking libraries after editing files:

$ORACLE_HOME/bin/relink all


This blog post guided you through the installation of Oracle 11g R2 Enterprise Edition, which is a much more complex process than the installation of Oracle XE (Express Edition). Installing Oracle database on Ubuntu requires that you perform manual configuration of files and system parameters.

Installing Oracle on Ubuntu Linux is not an easy task, but Oracle Enterprise Edition offers many advantages. The Oracle installation steps that require great attention on your part are installing Ubuntu packages, linking binaries, and creating a startup script. If your versions of Ubuntu and Oracle are the same as the versions used in this post, follow the step-by-step tutorial for a successful Oracle installation. After deploying the Oracle database don’t forget to make backups.

1 Year of Free Data Protection: NAKIVO Backup & Replication

1 Year of Free Data Protection: NAKIVO Backup & Replication

Deploy in 2 minutes and protect virtual, cloud, physical and SaaS data. Backup, replication, instant recovery options.

People also read