DEV Community

Cover image for Install Oracle Database 19c on Centos using RPM Package
Samuel Ajisafe
Samuel Ajisafe

Posted on

5 1

Install Oracle Database 19c on Centos using RPM Package

Installing Oracle Database 19c on CentOS 9 for development or testing can be a complex process. Many users encounter errors during installation, and I have also faced challenges. However, by following a systematic approach, as outlined in this guide, you can successfully install Oracle Database 19c on CentOS 9.

Below is a step-by-step guide, including the installation of necessary packages, configuration of environment variables, and setting up systemd for managing the Oracle service.

Step 1: Install Pre-Installation RPM Package
First, install the Oracle Database pre-installation RPM package, which prepares your system by installing necessary packages and setting up kernel parameters.

sudo dnf -y install https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el8.x86_64.rpm
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Oracle Database 19c
Download and Configure Repository:

Download the public YUM repository for Oracle Linux 7 and disable it by default:

sudo curl https://public-yum.oracle.com/public-yum-ol7.repo -o /etc/yum.repos.d/public-yum-ol7.repo
sudo sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/public-yum-ol7.repo
Enter fullscreen mode Exit fullscreen mode

Import the GPG Key and Install Pre-Installation Package:

sudo rpm --import http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7
sudo yum --enablerepo=ol7_latest -y install oracle-database-preinstall-19c
Enter fullscreen mode Exit fullscreen mode

Copy and Install Oracle Database RPM:

sudo cp /opt/oracle-database-ee-19c-1.0-1.x86_64.rpm .
sudo rpm -Uvh oracle-database-ee-19c-1.0-1.x86_64.rpm
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure Oracle Database
Edit Configuration File:

Open the Oracle Database configuration file to set listener ports and data locations:

sudo vi /etc/sysconfig/oracledb_ORCLCDB-19c.conf
Enter fullscreen mode Exit fullscreen mode

Example configuration:

LISTENER_PORT=1521
ORACLE_DATA_LOCATION=/opt/oracle/oradata
EM_EXPRESS_PORT=5500
Enter fullscreen mode Exit fullscreen mode

Run Oracle Database Configuration:

sudo /etc/init.d/oracledb_ORCLCDB-19c configure
Enter fullscreen mode Exit fullscreen mode

Step 4: Set Up User Environment
Update User Profile:

Switch to Oracle User:

su - oracle
Enter fullscreen mode Exit fullscreen mode

Edit your .bash_profile to include the Oracle environment variables:

vi ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Example content:

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

PATH=$PATH:$HOME/bin
export PATH
Enter fullscreen mode Exit fullscreen mode

Apply Profile Changes:

source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Access Oracle SQL Plus:

sqlplus / as sysdba
Enter fullscreen mode Exit fullscreen mode

exit

Edit Oracle Configuration Files:

Edit /etc/oratab:

sudo vi /etc/oratab
Enter fullscreen mode Exit fullscreen mode

Example entry:

ORCLCDB:/opt/oracle/product/19c/dbhome_1:Y
Enter fullscreen mode Exit fullscreen mode

Create /etc/sysconfig/ORCLCDB.oracledb:

sudo vi /etc/sysconfig/ORCLCDB.oracledb
Enter fullscreen mode Exit fullscreen mode

Example content:

ORACLE_BASE=/opt/oracle/oradata
ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ORACLE_SID=ORCLCDB
Enter fullscreen mode Exit fullscreen mode

Create Systemd Service File:

sudo vi /usr/lib/systemd/system/ORCLCDB@oracledb.service
Enter fullscreen mode Exit fullscreen mode
[Unit]
Description=Oracle Database service
After=network.target lsnrctl.service

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/ORCLCDB.oracledb
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/dbstart $ORACLE_HOME
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/dbshut $ORACLE_HOME
User=oracle

[Install]
WantedBy=multi-user.target
Enter fullscreen mode Exit fullscreen mode

Reload and Enable the Service:

sudo systemctl daemon-reload
sudo systemctl enable ORCLCDB@lsnrctl ORCLCDB@oracledb
Enter fullscreen mode Exit fullscreen mode

Reference: Server World

DevOps #DBA #ORACLE #Database #SysAdmin #Data

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay