How to install Oracle Database 18c XE on Linux

The new version of the free Oracle Database edition, Oracle Database 18c Express Edition, just got released for Linux 64-bit. Getting started is really simple on Oracle Linux, basically a three step process of downloading the RPM file, installing it and then configuring the database. On other Red Hat  compatible Linux distributions you will also have to download the Oracle Database Preinstall RPM alongside the XE RPM file. Here is a quick guide on how to setup Oracle Database 18c XE.

tl;dr

Oracle Linux

  1. Download the RPM file from Oracle Technology Network
  2. Run “yum -y localinstall oracle-database*18c*
  3. Run “/etc/init.d/oracle-xe-18c configure

Other Red Hat compatible Linux distribution

  1. Download the RPM file from Oracle Technology Network
  2. Download the Oracle Database Preinstall RPM via “curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
  3. Run “yum -y localinstall oracle-database*18c*
  4. Run “/etc/init.d/oracle-xe-18c configure

Downloading the RPM file

The download is straight forward as usual. Just head over to https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html, accept the license agreement after reading it, and download the RPM file.

Downloading the Oracle Database Preinstall RPM file

If you run on Oracle Linux, you can skip this step! The Oracle Database Preinstall RPM file will be pulled automatically by the yum command.

Download the Oracle Database Preinstall RPM by executing:

curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

If you happen to be behind a firewall and need to specify a proxy, you can do so by running “export https_proxy=:; export http_proxy=:” beforehand, for example:

export https_proxy=proxy.example.com:80
export http_proxy=proxy.example.com.80
curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

Installing the RPM file

In order to install the RPM file(s) you will have to have root privileges. This means that you either have to have access to the root user or have sudo permissions. To install the Oracle Database 18c XE binaries, execute:

yum –y localinstall oracle-database*18c*

Note that the rpm file has to be in the working directory where you execute yum. Once yum is running, you will see a similar output to this:

[root@localhost gerald]# yum -y localinstall oracle-database-xe-18c-1.0-1.x86_64.rpm
Loaded plugins: langpacks, ulninfo
Examining oracle-database-xe-18c-1.0-1.x86_64.rpm: oracle-database-xe-18c-1.0-1.x86_64
Marking oracle-database-xe-18c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-xe-18c.x86_64 0:1.0-1 will be installed
--> Processing Dependency: oracle-database-preinstall-18c for package: oracle-database-xe-18c-1.0-1.x86_64
ol7_UEKR4 | 1.2 kB 00:00:00
ol7_latest | 1.4 kB 00:00:00
(1/4): ol7_UEKR4/x86_64/updateinfo | 80 kB 00:00:00
(2/4): ol7_latest/x86_64/updateinfo | 568 kB 00:00:00
(3/4): ol7_UEKR4/x86_64/primary | 2.5 MB 00:00:00
(4/4): ol7_latest/x86_64/primary | 7.8 MB 00:00:01
ol7_UEKR4 110/110
ol7_latest 8768/8768
--> Running transaction check
---> Package oracle-database-preinstall-18c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: compat-libcap1 for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Processing Dependency: ksh for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Processing Dependency: libaio-devel for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Processing Dependency: glibc-devel for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Processing Dependency: compat-libstdc++-33 for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-database-preinstall-18c-1.0-1.el7.x86_64
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-7.el7 will be installed
---> Package compat-libstdc++-33.x86_64 0:3.2.3-72.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-222.0.7.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-222.0.7.el7 for package: glibc-devel-2.17-222.0.7.el7.x86_64
--> Processing Dependency: glibc = 2.17-222.0.7.el7 for package: glibc-devel-2.17-222.0.7.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-222.0.7.el7.x86_64
---> Package ksh.x86_64 0:20120801-137.0.1.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-28.0.1.el7_5.1 will be installed
--> Running transaction check
---> Package glibc.x86_64 0:2.17-222.el7 will be updated
--> Processing Dependency: glibc = 2.17-222.el7 for package: glibc-common-2.17-222.el7.x86_64
---> Package glibc.x86_64 0:2.17-222.0.7.el7 will be an update
---> Package glibc-headers.x86_64 0:2.17-222.0.7.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-222.0.7.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-222.0.7.el7.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-222.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-222.0.7.el7 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-862.14.4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
oracle-database-xe-18c x86_64 1.0-1 /oracle-database-xe-18c-1.0-1.x86_64 5.2 G
Installing for dependencies:
compat-libcap1 x86_64 1.10-7.el7 ol7_latest 17 k
compat-libstdc++-33 x86_64 3.2.3-72.el7 ol7_latest 190 k
glibc-devel x86_64 2.17-222.0.7.el7 ol7_latest 1.1 M
glibc-headers x86_64 2.17-222.0.7.el7 ol7_latest 679 k
kernel-headers x86_64 3.10.0-862.14.4.el7 ol7_latest 7.1 M
ksh x86_64 20120801-137.0.1.el7 ol7_latest 881 k
libaio-devel x86_64 0.3.109-13.el7 ol7_latest 12 k
libstdc++-devel x86_64 4.8.5-28.0.1.el7_5.1 ol7_latest 1.5 M
oracle-database-preinstall-18c x86_64 1.0-1.el7 ol7_latest 18 k
Updating for dependencies:
glibc x86_64 2.17-222.0.7.el7 ol7_latest 3.6 M
glibc-common x86_64 2.17-222.0.7.el7 ol7_latest 11 M

Transaction Summary
=====================================================================================================================================
Install 1 Package (+9 Dependent packages)
Upgrade ( 2 Dependent packages)

Total size: 5.2 G
Total download size: 27 M
Downloading packages:
No Presto metadata available for ol7_latest
(1/11): compat-libcap1-1.10-7.el7.x86_64.rpm | 17 kB 00:00:00
(2/11): compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm | 190 kB 00:00:00
(3/11): glibc-2.17-222.0.7.el7.x86_64.rpm | 3.6 MB 00:00:01
(4/11): glibc-devel-2.17-222.0.7.el7.x86_64.rpm | 1.1 MB 00:00:00
(5/11): glibc-headers-2.17-222.0.7.el7.x86_64.rpm | 679 kB 00:00:00
(6/11): glibc-common-2.17-222.0.7.el7.x86_64.rpm | 11 MB 00:00:03
(7/11): ksh-20120801-137.0.1.el7.x86_64.rpm | 881 kB 00:00:00
(8/11): kernel-headers-3.10.0-862.14.4.el7.x86_64.rpm | 7.1 MB 00:00:01
(9/11): libaio-devel-0.3.109-13.el7.x86_64.rpm | 12 kB 00:00:00
(10/11): oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm | 18 kB 00:00:00
(11/11): libstdc++-devel-4.8.5-28.0.1.el7_5.1.x86_64.rpm | 1.5 MB 00:00:00
-------------------------------------------------------------------------------------------------------------------------------------
Total 6.1 MB/s | 27 MB 00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : glibc-common-2.17-222.0.7.el7.x86_64 1/14
Updating : glibc-2.17-222.0.7.el7.x86_64 2/14
Installing : compat-libcap1-1.10-7.el7.x86_64 3/14
Installing : compat-libstdc++-33-3.2.3-72.el7.x86_64 4/14
Installing : ksh-20120801-137.0.1.el7.x86_64 5/14
Installing : libstdc++-devel-4.8.5-28.0.1.el7_5.1.x86_64 6/14
Installing : libaio-devel-0.3.109-13.el7.x86_64 7/14
Installing : kernel-headers-3.10.0-862.14.4.el7.x86_64 8/14
Installing : glibc-headers-2.17-222.0.7.el7.x86_64 9/14
Installing : glibc-devel-2.17-222.0.7.el7.x86_64 10/14
Installing : oracle-database-preinstall-18c-1.0-1.el7.x86_64 11/14
Installing : oracle-database-xe-18c-1.0-1.x86_64 12/14
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-18c.conf' and then execute '/etc/init.d/oracle-xe-18c configure' as root.
Cleanup : glibc-common-2.17-222.el7.x86_64 13/14
Cleanup : glibc-2.17-222.el7.x86_64 14/14
Verifying : glibc-2.17-222.0.7.el7.x86_64 1/14
Verifying : kernel-headers-3.10.0-862.14.4.el7.x86_64 2/14
Verifying : glibc-common-2.17-222.0.7.el7.x86_64 3/14
Verifying : oracle-database-preinstall-18c-1.0-1.el7.x86_64 4/14
Verifying : glibc-headers-2.17-222.0.7.el7.x86_64 5/14
Verifying : compat-libcap1-1.10-7.el7.x86_64 6/14
Verifying : compat-libstdc++-33-3.2.3-72.el7.x86_64 7/14
Verifying : glibc-devel-2.17-222.0.7.el7.x86_64 8/14
Verifying : libaio-devel-0.3.109-13.el7.x86_64 9/14
Verifying : libstdc++-devel-4.8.5-28.0.1.el7_5.1.x86_64 10/14
Verifying : oracle-database-xe-18c-1.0-1.x86_64 11/14
Verifying : ksh-20120801-137.0.1.el7.x86_64 12/14
Verifying : glibc-common-2.17-222.el7.x86_64 13/14
Verifying : glibc-2.17-222.el7.x86_64 14/14

Installed:
oracle-database-xe-18c.x86_64 0:1.0-1

Dependency Installed:
compat-libcap1.x86_64 0:1.10-7.el7 compat-libstdc++-33.x86_64 0:3.2.3-72.el7
glibc-devel.x86_64 0:2.17-222.0.7.el7 glibc-headers.x86_64 0:2.17-222.0.7.el7
kernel-headers.x86_64 0:3.10.0-862.14.4.el7 ksh.x86_64 0:20120801-137.0.1.el7
libaio-devel.x86_64 0:0.3.109-13.el7 libstdc++-devel.x86_64 0:4.8.5-28.0.1.el7_5.1
oracle-database-preinstall-18c.x86_64 0:1.0-1.el7

Dependency Updated:
glibc.x86_64 0:2.17-222.0.7.el7 glibc-common.x86_64 0:2.17-222.0.7.el7

Complete!

Once yum executed successfully, the Oracle Database 18c Express Edition binaries are installed. Next and last step is to configure the database itself.

Configuring the database

To configure the XE database you need to run /etc/init.d/oracle-xe-18c configure, once again, as either root or with root privileges.

[root@localhost gerald]# /etc/init.d/oracle-xe-18c configure
Specify a password to be used for database accounts.
Oracle recommends that the password entered should be at least 8 characters in length,
contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:

Type in and confirm the password for the administrative accounts, SYS, SYSTEM and PDBADMIN, and hit Enter.

Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database XE.
Enter SYS user password:
***************
Enter SYSTEM user password:
************
Enter PDBADMIN User Password:
*************
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
31% complete
34% complete
38% complete
41% complete
43% complete
Completing Database Creation
47% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/XE.
Database Information:
Global Database Name:XE
System Identifier(SID):XE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/XE/XE.log" for further details.

Connect to Oracle Database using one of the connect strings:
Pluggable database: localhost.localdomain/XEPDB1
Multitenant container database: localhost.localdomain
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE
[root@localhost gerald]#

After the command has finished, the Oracle Database 18c XE is fully configured and ready to use.

Connecting to Oracle Database 18c XE

To fire up the SQL prompt for your user, you will have to make sure that $ORACLE_HOME is set and $ORACLE_HOME/bin in your $PATH. There is a utility script called oraenv, that will configure that and more for your. All you have to do is to call it for your local shell (note the . before the script name below) and pass on the $ORACLE_SID, which is XE:

[gerald@localhost ~]$ . oraenv
ORACLE_SID = [gerald] ? XE
ORACLE_BASE environment variable is not being set since this
information is not available for the current user ID gerald.
You can set ORACLE_BASE manually if it is required.
Resetting ORACLE_BASE to its previous value or ORACLE_HOME
The Oracle base has been set to /opt/oracle/product/18c/dbhomeXE

Once you have done that you can connect via the SQL prompt. The format for the connect string is: [user]/[password]@//[hostname]:[port]/[DB name] [AS [role]]

[gerald@localhost ~]$ sqlplus sys/GetStarted18c@//localhost:1521/XE as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Fri Oct 19 09:05:41 2018
Version 18.4.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

SQL> SELECT 'Hello World!' FROM dual;

'HELLOWORLD!
------------
Hello World!

SQL> exit
Disconnected from Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

More information

Author: Gerald

Developer, Oracle expert, performance enthusiast and genuine technology geek.

6 thoughts on “How to install Oracle Database 18c XE on Linux”

  1. Hi! What kind of “Red Hat compatible Linux distribution” you used? If it is CentOS what version?
    I tried the newest 7.5.1804 (Minimal-ISO) and everything is fine until the db configuration (Listener configuration failed). It seems not to be the only one with the problem – I found these (unanswered) posts: https://community.oracle.com/thread/4180595

    Any ideas?

    Like

    1. Hi Carlos,

      There is only one kind of Red Hat compatible OS, which are those that support the RedHat Package Manager (RPM) and the same libraries.

      The issue in the community post is that the underlying Java VM crashes when executing a Java program. Do you have the same issue?

      You might want to post your issue in the community forum as well.

      Thx,

      Like

      1. Yes. I have exactly the same problem. For me it’s interesting that it doesn’t work “out of the box” although I downloaded a fresh centos without modifying nothing (except updates and the oracle presinstall package). It seems to be a very specific problem with – you’re right – the underlying JAVA VM. You don’t had this issue when you install 18c XE on the “red hat compatible OS”? Can you post what distribution and kernel version you used for your test (the video)? And what JAVA (java -version) is installed? OpenJDK or Oracles Java (8 or 9)?

        And yes… I will post in the forum too. Hoped that the issue (4180595) solved earlier…

        Like

        1. Hey Carlos,

          The versions for Oracle Linux I have XE running, is:

          [gerald@localhost ~]$ cat /etc/oracle-release
          Oracle Linux Server release 7.5
          [gerald@localhost ~]$ uname -a
          Linux localhost.localdomain 4.1.12-124.19.7.el7uek.x86_64 #2 SMP Sat Sep 29 17:29:22 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

          The Java version used for netca gets shipped with the installation. When you look at $ORACLE_HOME/bin/netca you will find the following lines:

          99 # External Directory Variables set by the Installer
          100 JRE_DIR=/opt/oracle/product/18c/dbhomeXE/jdk/jre
          101 JLIB_DIR=/opt/oracle/product/18c/dbhomeXE/jlib
          102
          103
          104 # JRE Executable and Class File Variables
          105 JRE=$JRE_DIR/bin/java

          That Java version itself will be the same as for you:

          -bash-4.2$ /opt/oracle/product/18c/dbhomeXE/jdk/jre/bin/java -version
          java version “1.8.0_171”
          Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
          Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

          On the Red Hat compatible OS I also used CentOS:

          [gerald@localhost ~]$ cat /etc/centos-release
          CentOS Linux release 7.5.1804 (Core)
          [gerald@localhost ~]$ uname -a
          Linux localhost.localdomain 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

          [oracle@localhost ~]$ /opt/oracle/product/18c/dbhomeXE/jdk/jre/bin/java -version
          java version “1.8.0_171”
          Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
          Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

          Like

    2. Carlos,

      I’ve found that re-running the configuration after it fails the first time works for me, so I’m using the following command:

      # /etc/init.d/oracle-xe-18c configure 2>&1 || \
      > cat /opt/oracle/cfgtoollogs/netca/netca_configure_out.log && \
      > /etc/init.d/oracle-xe-18c configure 2>&1

      Like

  2. Hey David,
    thanks for you answer – but it didn’t work for me! I’ve tried it several times in different states of my virtual environment but always failed.

    You’ve executed all these commands as root user? Or as oracle user with root privileges (sudo)? You used the minimal ISO (no GUI) from CentOS? Did you update the system after configuring? You used VirtualBox too?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.