How to Install Oracle Database 12c on RHEL/CentOS 7

Oracle database is one of the most widely used relational database management systems (RDBMS) in enterprise environments. Developed, maintained, and supported by Oracle Corporation, this RDBMS is often installed on top of a flavor of Enterprise Linux (RHEL, CentOS, or Scientific Linux). This makes for a very robust operating system – database choice.

In this article, we will explain how to install Oracle 12c Release 2 on a RHEL/CentOS 7 GUI server.

Attention: RHEL/CentOS 6 users can follow this guide to Install Oracle Database 12c on RHEL/CentOS 6.x

Let’s begin.


After installing Oracle 12c, the configuration will be performed through a graphical interface. That is the reason why we need a CentOS 7 server with the X Window System software group installed.

Read Also: Install GUI (Gnome) on RHEL/CentOS 7 Server

Additionally, please note that an Oracle account is required to download the Oracle Database 12c installation file (3.2 GB). Don’t worry about this, though, as you can create an account for free.

Finally, make sure your server has at least 2 GB of RAM and 30 GB of available disk space. These hardware requirements are safe for a testing environment such as ours, but will need to increase if you consider using Oracle in production.

Preparing for Oracle 12c Installation

1. To begin, make sure that all the packages currently installed on your RHEL/CentOS 7 system are updated to their latest versions.

# yum update -y

2. Next, installed all the required dependencies for the RDBMS, along with the zip and unzip packages.

# yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 zip unzip

3. Create the user account and groups for Oracle.

# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle

Finally, set a password for the newly created oracle account.

# passwd oracle

4. Add the following kernel parameters to /etc/sysctl.conf file.

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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 = 1048586

and apply them:

# sysctl -p
# sysctl -a

5. Set the limits for oracle in /etc/security/limits.conf file.

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

6. Create a directory named /stage and extract the zipped installation file.

# unzip -d /stage/

Before proceeding, create other directories that will be used during the actual installation, and assign the necessary permissions.

# mkdir /u01
# mkdir /u02
# chown -R oracle:oinstall /u01
# chown -R oracle:oinstall /u02
# chmod -R 775 /u01
# chmod -R 775 /u02
# chmod g+s /u01
# chmod g+s /u02

We are now ready to run the installation script.

7. Open a GUI session in the RHEL/CentOS 7 server and launch the installation script.


and follow the steps presented by the installer.

Installing Oracle 12c on CentOS 7

8. Enter the email address associated with your Oracle account (optional).

Oracle Account Email Address
Oracle Account Email Address

9. Choose Create and configure a database.

Configure a Oracle Database
Configure a Oracle Database

10. Select Desktop class since we are setting up a minimal configuration and a starter database.

Oracle Desktop Class Installation
Oracle Desktop Class Installation

11. Select the following options for basic configuration.

  • Oracle base: /u01/app/oracle
  • Software location: /u01/app/oracle/product/12.2.0/dbhome_1
  • Database file location: /u01
  • OSDBA group: dba
  • Global database name: your choice. We chose tecmint here.
  • Take note of the password, as you will be using it when you first connect to the database.
  • Uncheck Create as Container database.
Oracle 12c Basic Configuration
Oracle 12c Basic Configuration

12. Leave the default Inventory Directory as /u01/app/oraInventory.

Oracle 12c Inventory Directory
Oracle 12c Inventory Directory

13. Verify that the installation pre-checks are completed without errors.

Oracle 12c Installation Settings
Oracle 12c Installation Settings

The installer will not let you past this point if any errors are found.

14. Wait until the Oracle 12c installation completes.

Oracle 12c Installation Progress
Oracle 12c Installation Progress

It is possible that at some point during the installation you will be asked to run a couple of scripts to set up further permissions or correct issues. This is illustrated here:

Oracle 12c Configuration Scripts
Oracle 12c Configuration Scripts

And here:

# cd /u01/app/oraInventory
# ./
# cd /u01/app/oracle/product/12.2.0/dbhome_1
# ./
Execute Oracle 12c Configuration Scripts
Execute Oracle 12c Configuration Scripts

15. After that, you will need to return to the previous screen in the GUI session and click OK so that the installation can continue.

When it is finished, you will be presented with the following message indicating the URL of the Oracle Enterprise Manager:


Oracle 12c Finishing Touches

16. To allow connections from outside the server, you will need to open the following ports:


As follows:

# firewall-cmd --zone=public --add-port=1521/tcp --add-port=5500/tcp --add-port=5520/tcp --add-port=3938/tcp --permanent
# firewall-cmd --reload

17. Next, login as oracle using the password that was chosen previously and add the following lines to .bash_profilefile.

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=tecmint; export ORACLE_SID
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH

18. Finally, replace localhost with on.

# vi $ORACLE_HOME/network/admin/listener.ora
Set Oracle 12c Listener
Set Oracle 12c Listener

19. The last step consists in reloading .bash_profile to apply the new settings.

# source .bash_profile

20. And then login to the database using the system account and the password chosen in Step 11 of the previous section.

# sqlplus [email protected]

Optionally, let’s create a table inside the tecmint database where we will insert some sample records as follows.

name VARCHAR2(20));

Please note that IDENTITY columns were first introduced in Oracle 12c.

SQL> INSERT INTO NamesTBL (name) VALUES ('Gabriel');
SQL> INSERT INTO NamesTBL (name) VALUES ('Admin');
Create Table in Oracle 12c Database
Create Table in Oracle 12c Database

Enabling Oracle to Start on System Boot

21. To enable the database service to start automatically on boot, add the following lines to /etc/systemd/system/oracle-rdbms.service file.

# /etc/systemd/system/oracle-rdbms.service
# Invoking Oracle scripts to start/shutdown Instances defined in /etc/oratab
# and starts Listener

Description=Oracle Database(s) and Listener

ExecStart=/u01/app/oracle/product/12.2.0/dbhome_1/bin/dbstart /u01/app/oracle/product/12.2.0/dbhome_1
ExecStop=/u01/app/oracle/product/12.2.0/dbhome_1/bin/dbshut /u01/app/oracle/product/12.2.0/dbhome_1


22. Finally, we need to indicate that the tecmint database should be brought up during boot in /etc/oratab (Y: Yes).

Enable Oracle 12c Database on Boot
Enable Oracle 12c Database on Boot

In this article, we have explained how to install Oracle 12c on RHEL/CentOS 7, how to create and configure a database, and how to create tables and insert rows of data.

Additionally, it is important to note that the database server should be up and running when the system boots, and our default database should be available at that point.

If you have any questions or comments about this article, feel free to drop us a line using the form below.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

27 thoughts on “How to Install Oracle Database 12c on RHEL/CentOS 7”

  1. If you are already logged as oracle user, changes in step 3 take effect only after log-out and log-in. Otherwise installer will not find proper ODSBA group and will suggest only oracle or wheel group.

  2. 1) Need to set stack size also for oracle in /etc/security/limits.conf

    2) Typo 12.1.0 should be 12.2.0 in

  3. In my case an extra line was necessary in limits.conf to pass the pre-cheks: oracle soft stack 10240

    And a question: is it safe to remove X Windows System and GNOME after successful installation?

  4. But wow, Oracle 12 is still using Flash for Enterprise Manager ? I haven’t worked with Oracle since 10g, but thought by now they would have gotten rid of Flash by now..

  5. Very nice step-by-step description to get Oracle 12 up and running.

    One small remark, in step 18 after you change the listener.ora you will have to stop/start the listener to make the changes take effect. (lsnrctl stop / lsnrctl start).

  6. Hi,

    I would like to know how I can implement step 7.

    Step 7. Open a GUI session in the RHEL/CentOS 7 server and launch the installation script.

    I have IBM cloud server machine and am able to connect through Putty. I installed Java 8 through Putty. I don’t have GUI.

    How do I do that?
    Please answer.

    • @Kumar,

      Try to launch the same installer script from the command-line and see, how it works? if it didn’t start, try to install GUI.

  7. Hi, thank you so much for this great tutorial.

    I have facing a problem when i run “runInstaller”.

    “Can’t connect to X11 window server using ‘:0’ as the value of the DISPLAY variable.”

    please help.

  8. Thank you so much Santiago for all the detailed steps!!

    Just one remark : to fully enable Oracle starting @ system boot use the following command.

    # systemctl enable oracle-rdbms.service

    It’s perfect!
    To be continued…

  9. Please check Step 17. You have a typo in the $ORACLE_HOME variable. You reference product 12.1.0, when it should be 12.2.0. Also, what are the credentials to login into the web interface?
    Thanks I completed my first install because of your article.


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.