How to install Oracle Database 18c XE on Oracle Linux 8

Marek Polak
5 min readOct 25, 2021

--

Photo by Gabriel Heinzer on Unsplash

I’ve recently found myself working on project which needs as RDBMS Oracle Database in minimal version 18c. I am used to develop locally on my MacBook Pro and unfortunately, Oracle for some reason doesn’t support macOS, so I was left with 2 options: either use Oracle 18c XE as a container in Docker, or use a dedicated hardware for it.

Since my MacBook Pro has it’s age, I try to keep it lightweight as possible. That way it has enough resources for simultaneous debugging several micro-services, reactJS/Angular frontend and few dozens opened tabs (mainly stack-overflow) in the browser 🤓.

Another reason for this setup was, that I had unused older PC lying in the closet waiting for some purpose. So let’s dive in & give it one together.

PC used in the setup is a 10+ year old low-power HTPC (AS Rock ION 330HT). It has 1.6GHz dualcore Intel Atom (330) processor with x64 architecture, 250GB disk and 2 GB RAM. Nothing spectacular, but it satisfies minimal requirements for Oracle 18c XE a gets the job done.

First step: Installation of Oracle Linux 8

Installation is pretty straightforward:

  1. Download Linux 8 ISO image (from https://yum.oracle.com/oracle-linux-isos.html). I recommend “Full ISO”, it’s the easiest way, but you can opt for the “Boot ISO” as well.
  2. Flash USB stick with the downloaded image, on MacOS use Balena Etcher, it takes literally 3 clicks. Be aware that the content of the USB will be erased and overwritten in the process.
  3. Boot the PC using this USB stick. You may need to go to BIOS first and change the boot preference, but if it works, the Oracle Linux 8 installer should start.
  4. If you opted for the “Boot ISO” image, you need to configure yum repositories as the installation source. You can use the ones provided by Oracle itself (as defined here).
Screenshot from Oracle installation site providing yum repositories configuration

Start installation & wait 20–60minutes (depending on your internet connection speed, performance of the PC, lunar cycle, …). Next steps assume that it went fine and server is up and running.

Second step: Install Oracle Database 18c XE

Following guide is based on magnificent post from Gerald:

Connect to the linux from your client PC using ssh & root account using ssh root@192.168.0.184 (replace with IP address of your server)

Download installation package:

curl -OL https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm

Install mandatory/missing dependencies:

dnf install -y /bin/bash /bin/sh /etc/redhat-release bc bind-utils binutils ethtool glibc glibc-devel initscripts ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make module-init-tools net-tools nfs-utils openssh-clients pam procps psmisc smartmontools sysstat unzip util-linux-ng xorg-x11-utils xorg-x11-xauth libnsl

and finally, install Oracle 18c XE Database:

rpm -i --nodeps oracle-database-xe-18c-1.0-1.x86_64.rpm

To configure the XE database you need to run /etc/init.d/oracle-xe-18c configure still as either root or with root privileges. Type in and confirm the password for the administrative accounts, SYS, SYSTEM and PDBADMIN, and hit Enter.

After a time, if everything went correct, you should see following output. At this point the Oracle Database 18c XE is fully configured and ready to use.

What if the installation went poorly?

If you don’t see the output above but see a failure instead, it’s possible that the installation is too hungry for resources and the setup needs to be slightly modified.

Configuration failed soon after reaching 9%

If you see an warning [WARNING] ORA-00821: Specified value of sga_target 396M is too small, needs to be at least 424M, followed by:

ORA-01078: failure in processing system parameters[FATAL] ORA-01034: ORACLE not available 

you’ll need reset the process and start again:

As first, we need to delete the current configuration — run (still as root) in the shell /etc/init.d/oracle-xe-18c delete.

Wait for completion statement and then change the config with:

sed -i ‘s/$MEMORY_CONSTRUCT/-initParams sga_target=500M,pga_aggregate_target=80M/’ /etc/init.d/oracle-xe-18c

Note that on my machine the warning above mentioned sga_target 396M is too small, so I increased the value to 500M.

Run the config script again (/etc/init.d/oracle-xe-18c configure), now it should get pass 9% without error.

Third step: Configure env-vars & verify installation

Last few steps we need to do to use our brand new DB locally, is to configure environment variables. If you try to fire up sqlplus now, you will get an error:

[root@localhost ~]# sqlplus
bash: sqlplus: command not found…

Follow the steps described here:

Now we can check the installation using sqlplus:

  • for XE DB: sqlplus system/[system-password]@127.0.0.1:1521/XE
  • for pluggable DB: sqlplus system/[system-password]@127.0.0.1:1521/XEPDB1
  • get DB name:

Lastly, check if the listener is running and configured properly via lsnrctl status in shell:

Congratulations, you are now able to use the Oracle DB on the Oracle Linux 8 locally! To connect to it from other clients on the network as in my case with the macbook, see the last section.

Connect to Database from remote clients

Our goal is to be able to connect to the Oracle XE DB using JDBC thin client — jdbc:oracle:thin:@192.168.0.184:1521/XEPDB1(replace with IP address of your server)

If the connection keeps failing and the Oracle listener is running and configured correctly (as above), we need to check and modify Linux firewall rules.

Great guide is to be found here: https://www.thegeekdiary.com/how-to-open-a-ports-in-centos-rhel-7/, I am posting only quick summary:

  • check port status:
  • check iptables: iptables-save | grep 1521
  • check port in /etc/services
  • add port to /etc/service if not shown (vi /etc/services)
  • open firewall port
  • restart firewall: firewall-cmd — reload
  • try JDBC connection again 👍

That should be all what is needed to have dedicated linux server running Oracle XE database 24/7. Happy hacking!

--

--

Marek Polak
0 Followers

Full stack developer based in Slovakia, constantly trying new things.