I am currently building a home server using CentOS 7.6. I install this OS on my AMD Phenom desktop. I am planning to use this server for my Oracle Database as well as Virtualization host. So in this port, I am going to share how to install Oracle Database 18c XE on CentOS 7.6.
I was thinking that installing Oracle in Linux is super hard. But in fact, even I cannot say that it is super easy, I still can do this. With some efforts and patience, I was able to run Oracle Database 18c on my CentOS Linux. If you are interested, here are the steps.
Before I install the Oracle Database, I do the following tasks:
- Update CentOS >> yum update command
- Create new “oracle” user >> useradd oracle command. I also create new password for my oracle user.
- Change or set the hostname. Edit the /etc/hosts file. I change my hostname to: server.griyaku.lan
Here is my /etc/hosts file looks like. Make sure you enter the hostname in a correct format.
Steps to Install Oracle Database 18c XE on CentOS 7.6
Here are the general steps of Installing Oracle Database 18c XE on CentOS 7.6.
- Download the installation files
- Install Oracle pre-install file
- Install and Configure Oracle Database
- Edit PATH
- Test the Connection
- Configure Database
- Configure Oracle Enterprise manager
Step 1. Download the Oracle Database 18c XE installation files
Use the link below to download the oracle pre-install file and also the Oracle database 18c XE installation file. Save the file to your download directory.
There are two files you will need to download.
You should now have the following files:
Step 2. Install Oracle Pre-Install file
yum localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
Step 3. Install and Configure Oracle Database
Now, install the Oracle Database package with this command as root
yum localinstall oracle-database-xe-18c-1.0-1.x86_64.rpm
This install process will take some times. In my case, it takes up to 15 minutes. Once installed, you will see the following
Configure Oracle Database Installation
This is an important step. Make sure it completes successfully and no error. Run this command as root user. During this process, you will need to create a password that will be used for SYS, SYSTEM and PDBADMIN accounts.
The configuration process will take up to 30 minutes in my case. So, be patient.
We are going to edit the tnsnames.ora file. We need to add our pluggable database information to this file.
Add these lines to the end of the file
(ADDRESS = (PROTOCOL = TCP)(HOST = server.griyaku.lan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XEPDB1) )
Change the value server.griyaku.lan with your hostname/domain name. Or, you can also put the IP address of your server running Oracle.
Step 4. Modify PATH
Now, let’s modify the PATH. We need to edit the file ~/.bash_profile.
Add the following line
Next, execute this command using oracle account
Step 5. Test the Connection using SQLPlus
You can try to connect to the new Oracle database using sqlplus
sqlplus sys as sysdba
[oracle@server admin]$ sqlplus sys as sysdba
SQL*Plus: Release 188.8.131.52.0 - Production on Wed Jan 23 06:23:04 2019 Version 184.108.40.206.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Enter password:
Step 6. Configure Database
Now we need to configure the database so it starts automatically during the system boot. To do this, login as root and execute this command
systemctl enable oracle-xe-18c
OK, so now Oracle database will be started on system boot. We can also start and stop the database manually using Oracle command
SQL> Startup >> Startup the database
SQL> Shutdown immediate >>Shutdown the database
Step 7. Configure Oracle Enterprise Manager
We can access the Oracle Enterprise Manager using address:
But, by default, Oracle EM only accessible from the localhost. We need to configure the Oracle EM so it accessible from remote client. Login to Oracle using sqlplus
sqlplus sys as sysdba
At first, I can open the EM from the CentOS machine. But, I cannot open it from other computer. So, I need to configure the firewalld to allow https and port 5500 used by Oracle EM. Here is the commands
firewall-cmd --zone=public --permanent --add-port=5500/tcp
firewall-cmd --zone=public --add-service=https --permanent
It’s a great feeling that I have successfully installed the Oracle Database 18c XE on my CentOS 7. It took about 2 hours to get everything run smoothly. The database configure process take a long time. So, that’s it. I hope you enjoy this article.