Install Oracle Database 21c XE On Linux 7


Oracle have released Oracle Database 21c Express Edition on Linux. Oracle Express Edition or XE is the free to use version of the database. You can download it from the following link:

In one of my previous posts, I demonstrated how to install Oracle Database 21c on Linux 7. In this post, I will show a step-by-step process of installing and setting up Oracle Database 21c XE on Oracle Linux 7. I have configured Linux 7 on Oracle Virtual Box. I won’t go through the steps to setup OL7 in this post. You can refer to this link to go through the detailed steps of installing Linux 7 (OL7). The software I used are:

System Requirements

RequirementValue
Network protocolThe following protocols are supported:
IPC
UDP
TCP/IP
TCP/IP with SSL
RAM1 GB of RAM minimum; 2 GB of RAM is recommended
Disk space10 GB minimum
Swap Space2 GB or twice the size of RAM, whichever is lesser

Prerequisites

Once you have downloaded and setup OL7, there are some prerequisite setups that needs to be performed before kicking off the installation. These steps are shown below.

Get the IP Address using ‘ifconfig’ or ‘ip addr’ command. For example:

[root@rishoradev21cXE ~]# ifconfig

Get the hostname.

[root@rishoradev21cXE ~]# hostname
rishoradev21cXE.com

Amend the IP address and hostname to ‘/etc/hosts’ file to resolve the hostname. You can use the vi editor for this.

[ Note: This can also be done with DNS ].

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.XX.X rishoradev21cXE.com oracledb21cXE

Download “oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm” re-install package. This package will perform all the setups that are necessary to install 21c.

[root@rishoradev21cXE ~]# curl -o oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 26264  100 26264    0     0  29209      0 --:--:-- --:--:-- --:--:-- 29214

Install the pre-requisite package using the yum installer. The Database Preinstallation RPM automatically creates Oracle installation owner and groups and sets up other kernel configuration settings as required for Oracle installations.

[root@rishoradev21cXE ~]# yum -y localinstall oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
Loaded plugins: langpacks, ulninfo
Examining oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm: oracle-database-preinstall-21c-1.0-1.el7.x86_64
Marking oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-21c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: ksh for package: oracle-database-preinstall-21c-1.0-1.el7.x86_64
ol7_UEKR4                                                                                                                                                                                                             | 3.0 kB  00:00:00
ol7_latest                                                                                                                                                                                                            | 3.6 kB  00:00:00
--> Running transaction check
---> Package ksh.x86_64 0:20120801-142.0.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
....

....
Installed:
  oracle-database-preinstall-21c.x86_64 0:1.0-1.el7

Dependency Installed:
  ksh.x86_64 0:20120801-142.0.1.el7

Complete!

The next step is not mandatory. But I prefer to run the ‘yum update’ because I wanted to make sure I had also the latest OS packages. It might take a while for all the packages to be installed.

[root@rishoradev21cXE ~]# yum update -y --skip-broken

Download Oracle Database 21c Express Edition for Linux x64 software and move it to a staging directory in the Linux server. Change the ownership and group of the installer.

[root@rishoradev21cXE ~]# chown -R oracle /stage/oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm
[root@rishoradev21cXE ~]# chgrp -R oinstall /stage/oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm

Disable firewall by issuing the following commands.

[root@rishoradev21cXE ~]# systemctl stop firewalld
[root@rishoradev21cXE ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

Change the password of “oracle” user.

[root@oracledb21col7 ~]# passwd oracle

Switch to “oracle” user.

[root@oracledb21col7 ~]# su - oracle

Installation

Navigate to the file-system where you have copied the installer.

[oracle@rishoradev21cXE ~]$ cd /stage
[oracle@rishoradev21cXE ~]$ ls -lrt
total 2284200
-rw-r--r--. 1 oracle oinstall 2339017432 Sep 24 19:57 oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm

Install the Oracle XE database software from the RPM file.

[oracle@rishoradev21cXE stage]$ sudo yum -y install oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm
[sudo] password for oracle:
Loaded plugins: langpacks, ulninfo
Examining oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm: oracle-database-xe-21c-1.0-1.x86_64
Marking oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-xe-21c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

....
....
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oracle-database-xe-21c-1.0-1.x86_64                                                                                                                                                                                       1/1
[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-21c.conf' and then execute '/etc/init.d/oracle-xe-21c configure' as root.
  Verifying  : oracle-database-xe-21c-1.0-1.x86_64                                                                                                                                                                                       1/1

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

Complete!

Once the installation is complete, create and configure the Oracle Database.

Creating and configuring Oracle Database

Switch to “root” user. ‘oracle-xe-21c.conf’ is the config file used to create the database. You can change the config file as required. Use any editor to edit the file. Here, I use the defaults.

[root@rishoradev21cXE ~]# vi /etc/sysconfig/oracle-xe-21c.conf

Create the database by running the configure operation. When prmpted, provide the passwords for SYS, SYSTEM and PDBADMIN users. This takes a few minustes to complete.

[root@rishoradev21cXE ~]# /etc/init.d/oracle-xe-21c 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:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database XE.
....
....
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: rishoradev21cXE.com/XEPDB1
     Multitenant container database: rishoradev21cXE.com
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE

This completes Oracle Database 21c XE installation and configuration. It is recommended to setup the environment variables before starting to use Oracle Database XE.

Setup the Environment Variables

The ‘oraenv’ script can be used to set your environment variables. 

[oracle@rishoradev21cXE ~]$ export ORACLE_SID=XE
[oracle@rishoradev21cXE ~]$ export ORAENV_ASK=NO

Initialize the environment variable using the oraenv file. Enter XE as the ORACLE_SID.

[oracle@rishoradev21cXE ~]$ . oraenv
ORACLE_SID = [oracle] ? XE
The Oracle base has been set to /opt/oracle

Use sqlplus to connect to the root container.

[oracle@rishoradev21cXE ~]$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Sat Sep 25 12:45:30 2021
Version 21.3.0.0.0

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


Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 XEPDB1                         READ WRITE NO

Congratulations!! You have successfully installed and configured Oracle Database 21c XE. Enjoy!!!

SQL> SELECT banner_full from v$version;

BANNER_FULL
------------------------------------------------------------------------------------------
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0


1 row selected.

References

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