DEV Community

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

Posted on

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

Top comments (0)