How to Install Oracle Database on Ubuntu?

Installing the Oracle database on Ubuntu has been widely applied and it might be relatively complex. But don’t worry, this blog can help you achive a successful Oracle installation.

download-icon
Free Download
for VM, OS, DB, File, NAS, etc.
iris-lee

Updated by Iris Lee on 2024/09/11

Table of contents
  • Installation of Oracle database on Ubuntu

  • Testing

  • Easily backup massive files on your Ubuntu machine

  • Conclusion

Are you looking for a robust Ubuntu file backup solution? Try Vinchin Backup & Recovery!↘ Download Free Trial

Ubuntu is a Linux distribution based on Debian. It is suitable for cloud computing, servers, desktops, and IoT devices. The main difference between Linux and Ubuntu is that the former is a Unix-based operating system, while Ubuntu is a Linux distribution.

The Oracle database is known for its excellent portability, user-friendly interface, and powerful functionality, which is suitable for various computer environments. It offers an efficient and reliable database solution that can handle high throughput requirements.

Installing the Oracle database on Ubuntu has been widely applied and is constantly being updated. Here introduces the installation and configuration of Oracle on Ubuntu to help you install and update the Ubuntu Oracle system. Ubuntu is a Linux-based operating system that is freely available and provides community and professional support. This blog documents the detailed process of installing Oracle 11 on Ubuntu.

Environment

Ubuntu: Ubuntu 14.04 LTS 64-bit

Oracle: Oracle 11

JDK: JDK 1.7

Memory: 1GB

Hard Disk: 20GB

CPU: 1 unit

Installation of Oracle database on Ubuntu

1.Download Oracle 11

Download Oracle 11 from the official website. The download link is as follows:

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

Save the downloaded files in the "/home" directory. There will be two compressed files. Extract them using the following commands:

sudo tar -zxvf linux.x64_11gR2_database_1of2.zip
sudo tar -zxvf linux.x64_11gR2_database_2of2.zip

Once the extraction is complete, a "database" folder will be created in the home directory. This folder is the installation directory for Oracle.

2.Installing JDK 1.7

You can install JDK 1.7 if desired.

Alternatively, you can use the default OpenJDK provided by Ubuntu Linux:

sudo apt-get install openjdk-7-jre
sudo apt-get install openjdk-7-jdk

3.Installing Remote Visual Desktop

Since the installation of Oracle involves using an installation wizard, it is necessary to install a remote visual desktop for the process.

4.Updating Source Files

The official sources of Ubuntu are not comprehensive, especially when installing the ia32-libs package. So you need to update the source files. First, back up the source file, and then add the following sources to the source list (delete all the existing sources and paste the following sources):

sudo cp /etc/apt/sources.list /etc/apt/sources.list_back

5.Installing Dependencies

After replacing the source files, execute the following commands for updates:

sudo apt-get update
sudo apt-get upgrade

Then, install the following dependencies. It is crucial to ensure the successful installation of each package, as a failure may result in an unsuccessful installation of Oracle.

sudo apt-get install bzip2
sudo apt-get install elfutils
sudo apt-get install automake
sudo apt-get install autotools-dev
sudo apt-get install binutils
sudo apt-get install expat
sudo apt-get install gawk
sudo apt-get install gcc
sudo apt-get install gcc-multilib
sudo apt-get install g++-multilib
sudo apt-get install ia32-libs
sudo apt-get install ksh
sudo apt-get install less
sudo apt-get install lesstif2
sudo apt-get install lesstif2-dev
sudo apt-get install lib32z1
sudo apt-get install libaio1
sudo apt-get install libaio-dev
sudo apt-get install libc6-dev
sudo apt-get install libc6-dev-i386
sudo apt-get install libc6-i386
sudo apt-get install libelf-dev
sudo apt-get install libltdl-dev
sudo apt-get install libmotif4
sudo apt-get install libodbcinstq4-1 libodbcinstq4-1:i386
sudo apt-get install libpth-dev
sudo apt-get install libpthread-stubs0
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libstdc++5
sudo apt-get install lsb-cxx
sudo apt-get install make
sudo apt-get install openssh-server
sudo apt-get install pdksh
sudo apt-get install rlwrap
sudo apt-get install rpm
sudo apt-get install sysstat
sudo apt-get install unixodbc
sudo apt-get install unixodbc-dev
sudo apt-get install unzip
sudo apt-get install x11-utils
sudo apt-get install zlibc

6.Check system variables

sudo /sbin/sysctl -a | grep sem
sudo /sbin/sysctl -a | grep shm
sudo /sbin/sysctl -a | grep file-max
sudo /sbin/sysctl -a | grep aio-max
sudo /sbin/sysctl -a | grep ip_local_port_range
sudo /sbin/sysctl -a | grep rmem_default
sudo /sbin/sysctl -a | grep rmem_max
sudo /sbin/sysctl -a | grep wmem_default
sudo /sbin/sysctl -a | grep wmem_max

After obtaining the parameter values from the above command, add the corresponding data in /etc/sysctl.conf. You can open two terminals to facilitate the entry.

sudo vim /etc/sysctl.conf

Fill the following contents in sysctl.conf with the obtained values:

fs.aio-max-nr = ?
fs.file-max = ?
kernel.shmall = ?
kernel.shmmax = ?
kernel.shmmni = ?
kernel.sem = ?
net.ipv4.ip_local_port_range = ?
net.core.rmem_default = ?
net.core.rmem_max = ?
net.core.wmem_default = ?
net.core.wmem_max = ?

Execute the command to update the kernel parameters:

sudo sysctl -p

7. Add the following data to the /etc/security/limits.conf file to set kernel limits for the current user (XXX represents your current username):

XXX  soft nproc 2047
XXX  hard nproc 16384
XXX  soft nofile 1024
XXX  hard nofile 65536
XXX  soft stack 10240

8. Examine /etc/pam.d/login and add the following lines (if they are not already present):

session required pam_limits.so

Inspect /etc/pam.d/su and add the following lines if they are not already present:

session required pam_limits.so

9. By default, Oracle does not support Ubuntu. To deceive the Oracle installation program, please execute the following commands:

sudo mkdir /usr/lib64
sudo ln -s /etc /etc/rc.d
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/
sudo ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib64/
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
echo ‘Ubuntu Linux release 14.04′ > /etc/ubuntu-release

If it is unable to execute the last command, you can use the following command instead:

sudo vim /etc/ubuntu-release

Add 'Ubuntu Linux release 14.04' to the ubuntu-release file, then save and exit.

10. Configure the environment variables for Oracle

sudo gedit ~/.profile

Add the following lines to the file (replace xxx with your current username):

export ORACLE_BASE=/home/xxx/app/xxx
export ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export PATH=PATH:${ORACLE_HOME}/bin/;

11. Start the Oracle installation program to begin the installation.

First, check if the Oracle environment variables are set as you specified:

echo $ORACLE_BASE
echo $ORACLE_HOME
echo $PATH

If they are not set correctly, open a new terminal, and it should work. Alternatively, execute the following command:

source ~/.profile

This command is used to make your environment variables effective.

Next, execute the following command to open the remote desktop service:

vncserver :1

Remember not to add 'sudo' before this command. Otherwise, it will open the remote desktop for the root user instead of the user you want to install for.

Now you can connect using the VNC-Viewer software on Windows:

Note: The number must match the port you opened.

Once the remote desktop is open, launch the terminal on the desktop. If the installation program is extracted in the main directory: /home/database, use the command:

cd /home/database

To avoid garbled characters, set the terminal's language to US by exporting first.

Then run the runInstaller in the directory: ./runInstaller.

You will enter the graphical installation interface, and then follow the installation wizard's prompts.

The prerequisite check will display a list of fails. Select “Ignore All,” then click “Finish.”

Please note that if your swap space is insufficient, you will receive a prompt indicating insufficient swap space, and installation cannot proceed.

To resolve this, open another terminal and use the following command to temporarily increase the swap space, then recheck it:

free -m
mkdir /swapfile
cd /swapfile
sudo dd if=/dev/zero of=swap bs=1024 count=400000
sudo mkswap -f swap
sudo swapon swap

12. Error at 68% installation progress

An error message related to ins_ctx.mk appears. Simply continue and skip it.

Later, another error is reported:

make file '/.../emagent.mk' encountered an error.

Solution:

Open a new terminal and enter the following command:

sudo sed -i 's/^(s*$(MK_EMAGENT_NMECTL))s*$/1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk

Click “Retry” on the installation interface, and the installation will continue.

Similar error prompts may appear four more times. Execute the following command line in the same way:

sudo sed -i 's/^($LD $LD_RUNTIME) ($LD_OPT)/1 -Wl,--no-as-needed 2/g' $ORACLE_HOME/bin/genorasdksh
sudo sed -i 's/^(s*)($(OCRLIBS_DEFAULT))/1 -Wl,--no-as-needed 2/g' $ORACLE_HOME/srvm/lib/ins_srvm.mk
sudo sed -i 's/^(TNSLSNR_LINKLINE.*$(TNSLSNR_OFILES)) ($(LINKTTLIBS))/1 -Wl,--no-as-needed 2/g' $ORACLE_HOME/network/lib/env_network.mk
sudo sed -i 's/^(ORACLE_LINKLINE.*$(ORACLE_LINKER)) ($(PL_FLAGS))/1 -Wl,--no-as-needed 2/g' $ORACLE_HOME/rdbms/lib/env_rdbms.mk

13. After the installation is complete, you will be prompted to run two sh files:

Open another terminal:

sudo /home/xxx/app/xxx/oracle/oraInventory/orainstRoot.sh
sudo /home/xxx/app/xxx/oracle/Oracle11gee/product/11.2.0/dbhome_1/root.sh

Installation completed!

Testing

1. Run sqlplus

Before running sqlplus, test the Oracle environment variables:

echo $ORACLE_BASE
echo $ORACLE_HOME
echo $PATH

If the displayed values match your configuration, you can proceed with the following steps.

2. Check the listener status of the database

Use command to check if the listener is actively running. In normal circumstances, it should display a lot of listener information.

If there is no output here, it means there is no listener and you need to configure it yourself:

lsnrctl status

Solution for no listener:

You can create a listener by running netca and accessing the graphical interface for setting up the listener.

If you haven't created a database, you can use dbca to create one at this point.

And you can run the following code to fix dbconsole:

emca -repos drop
emca -repos create
emca -config dbcontrol db
emca start dbconsole

At this point, the database should be up and running.

If there is no listener, execute the following command to start it:

lsnrctl start

3. Start the Oracle database

Enter the following command to start sqlplus:

sqlplus / as sysdba

The commands to start and stop Oracle are as follows:

SQL> startup
SQL> shutdown

During startup, you will see a message indicating that your “orcl” instance has been successfully loaded.

Easily backup massive files on your Ubuntu machine

The installation process of the Oracle database on Ubuntu can be relatively complex, so it is recommended that you back up important data and ensure that your system has been properly configured and permissions have been set before performing any operations.

Vinchin Backup & Recovery

Vinchin Backup & Recovery is a professional backup and recovery solution for 10+ virtual platforms, 6 databases, NAS and physical servers like Windows/Linux servers.

Besides backing up virtual machines, you can also back up files in Ubuntu using Vinchin Backup & Recovery. With fast backup speed, it can perform backup of massive files at one time.  And with a lightweight file backup agent installed on the target operating system, files inside the server can be backed up and restored easily.

A user-friendly web console will help easily perform backup and restore files on Ubuntu. You just need to follow the steps below:

Select the target files > select the backup destination > select backup strategies > submit the job

Vinchin Backup & Recovery has been selected by thousands of companies and you can also start to use this powerful system with a 60-day full-featured trial! Also, contact us and leave your needs, and then you will receive a solution according to your IT environment.

Conclusion

This blog gives you detailed guides to help you install Oracle database on Ubuntu. You can follow the step-by-step tutorial for a successful Oracle installation If your versions of Ubuntu and Oracle are the same as the versions used in this post.

Also, don’t forget to backup your files with Vinchin Backup & Recovery to enssure data security. Don’t miss the free trial as well!

Share on:

Categories: Tech Tips
Free Trial Now close-icon