How to Install Oracle Database 21C on CentOS 8 (Fast and Reliable)
If you’re looking to spin up a fresh Oracle 21C instance on CentOS 8, this quick walk‑through will get you there without the usual guesswork. You’ll learn which packages matter, how to tweak the environment so the installer talks straight to the system, and one trick that saved me from hours of frustration when I first tried it.
1. Grab the Right Packages
Oracle ships its database as a single RPM bundle for Linux. The easiest way is to download the oracle-database-preinstall-21c helper RPM from Oracle’s public repository, then pull the main database package from an Oracle Software Delivery Cloud mirror or your own local repo.
Why bother with the pre‑install helper? It pulls in all the OS dependencies (glibc, libaio, binutils) that Oracle demands and configures system limits. Skipping it usually leaves you staring at “libaio.so missing” errors later.
sudo dnf install https://download.oracle.com/otn/linux/oracle21c/preinstall/rpm/oracle-database-preinstall-21c.rpm
2. Set Oracle‑Specific Environment Variables
Oracle’s installer looks for a handful of variables in the shell profile. If they’re missing, you’ll get cryptic “ORA‑20001: installation failed” messages.
echo 'export ORACLE_BASE=/opt/oracle' | sudo tee /etc/profile.d/oracle.sh echo 'export ORACLE_HOME=$ORACLE_BASE/product/21c/dbhome_1' | sudo tee -a /etc/profile.d/oracle.sh echo 'export PATH=$ORACLE_HOME/bin:$PATH' | sudo tee -a /etc/profile.d/oracle.sh source /etc/profile.d/oracle.sh
Notice the comment: I once hit a snag because my PATH didn’t include $ORACLE_HOME/bin, so the installer couldn’t find sqlplus. It’s a tiny oversight that can waste hours.
3. Turn SELinux Off (or Put in Permissive)
CentOS 8 ships with SELinux enabled by default, and Oracle is picky about context labels. The easiest route for a fresh install is to set it to permissive mode until you’re sure the database is up and running.
sudo setenforce 0 # temporary, reverts on reboot sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
If you prefer to keep enforcing, you’ll need to create custom boolean policies—more trouble than it’s worth for a test lab.
4. Install the Database RPM
With the environment ready, run the Oracle installer:
sudo yum localinstall oracle-database-se-21c-1.0-1.x86_64.rpm
During the installation wizard, choose “Typical” unless you have a specific reason to go custom. The wizard will ask for a database name, character set, and memory allocation. Pick what makes sense for your workload; the defaults are fine for most dev setups.
5. Configure the Listener
The listener is Oracle’s network gatekeeper. The installer can create one automatically, but it’s good to double‑check that tnsnames.ora points to the right host and port.
$ORACLE_HOME/bin/lsnrctl status
If you see “no listener” or a port conflict, start it manually:
sudo $ORACLE_HOME/bin/lsnrctl start
6. Create a Database User (Optional but Handy)
After the database is up, add a non‑sys user to avoid running everything as oracle. This mirrors how production databases are managed.
sqlplus / as sysdba CREATE USER dev IDENTIFIED BY dev123; GRANT CONNECT, RESOURCE TO dev;
7. Verify the Install
A quick health check confirms that all services are humming:
systemctl status oracle-xe-21c $ORACLE_HOME/bin/sqlplus system/password@XE as sysdba SQL> SELECT * FROM v$version;
If you get a list of Oracle version strings, congratulations—you’re ready to start building.
8. Common Pitfalls and How I Avoided Them
- Wrong kernel version – CentOS 8’s default kernel works fine for 21C, but if you upgrade to a custom kernel (e.g., from a newer RHEL), the installer might choke on missing modules.
- SELinux context errors – Forgetting to set setenforce to permissive is a classic rookie mistake. I used a quick script that checks SELinux status before running the installer.
- Missing locale – Oracle likes UTF‑8. If your system default is something else (like en_US), the installation will abort with “ORA‑20001: unsupported character set.” Set export LANG=en_US.UTF-8 in /etc/profile.d/oracle.sh.
9. Wrap Up
You’ve now got a fully functional Oracle Database 21C running on CentOS 8, ready for whatever projects you throw at it. Remember to keep your OS patched and the database backed up—Oracle can be a bit heavy-handed if you ignore those basics.