/ Server

Install Oracle XE on Oracle Linux (Converted from CentOS 6).

In this post, we'll learn about installing Oracle XE 11g on Oracle Linux. The Oracle Linux is obtained from converting CentOS 6.

Oracle Linux is a Linux distribution packaged and freely distributed by Oracle, available partially under the GNU General Public License since late 2006.

The easiest way to install Oracle Database Server is through Oracle Linux distribution. It's free, we can easily get it from Oracle Linux Download Page.

There is also alternative way to get the Oracle Linux, by converting CentOS into Oracle Linux. And in this post we'll use this scenario.


Table of Contents

  1. Install Virtual Box, Vagrant, and vagrant-vbguest plugin
  2. Prepare the CentOS VM
  3. Convert CentOS 6 into Oracle Linux
  4. Installing Oracle XE 11g
  5. Connect to Oracle XE

1. Install Virtual Box, Vagrant, and vagrant-vbguest plugin

We will install the linux as virtual machine. By using Vagrant it can be done easily.

So before we start everything, vagrant need to be installed first on local machine, go follow official vagrant installation guide.

Vagrant depend on Virtual Box, so make sure it's installed as well. You can get the installer from Virtual Box download page.

Next, install the vagrant-vbguest plugin, to enable sharing folder between host and VM.

$ vagrant plugin install vagrant-vbguest
$ vagrant vbguest

# Loaded plugins: fastestmirror, security
# Setting up Install Process
# Loading mirror speeds from cached hostfile
# Package gcc-4.4.7-23.0.1.el6.x86_64 already installed and latest version
# Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
# Mounting Virtualbox Guest Additions ISO to: /mnt
# Installing Virtualbox Guest Additions 5.2.12 - guest version is unknown
# 
# ...
# 
# The log file /var/log/vboxadd-setup.log may contain further information.
# Unmounting Virtualbox Guest Additions ISO from: /mnt

2. Prepare the CentOS VM

Ok, let's do this! First, create new folder, then initialize vagrant environment in it.

$ cd ~/Desktop
$ mkdir oracle-linux
$ cd oracle-linux
$ vagrant init

Edit the Vagrantfile, set the box to centos/6. Also enable the private networking (by default the configuration already there, just uncomment the line). Configure the shared folder as well.

$ nano Vagrantfile 

# adjust the content like below

Vagrant.configure("2") do |config|

  config.vm.box = "centos/6"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.synced_folder ".", "/vagrant_data"

  # ...
  
end

Start the environment. For newly created env, it'll perform certain process (like downloading the os image, installing it, etc) before finally started. Then after it's done, the VM will be up.

$ vagrant up

# Bringing machine 'default' up with 'virtualbox' provider...
# ==> default: Box 'centos/6' could not be found. Attempting to find and install...
#     default: Box Provider: virtualbox
#     default: Box Version: >= 0
# ==> default: Loading metadata for box 'centos/6'
#     default: URL: https://vagrantcloud.com/centos/6
# ==> default: Adding box 'centos/6' (v1804.02) for provider: virtualbox
#     default: Downloading: https://vagrantcloud.com/centos/boxes/6/versions/1804.02/providers/virtualbox.box
# 
# ... will take some time, really depend on the internet speed (unless the box already downloaded before)
#
#     default: This is not an error message; everything may continue to work properly,
#     default: in which case you may ignore this message.
# ==> default: Configuring and enabling network interfaces...
#     default: SSH address: 127.0.0.1:2222
#     default: SSH username: vagrant
#     default: SSH auth method: private key
# ==> default: Rsyncing folder: /Users/novalagung/Desktop/oracle-linux/ => /vagrant

Access the VM through SSH, use vagrant ssh for that.

$ vagrant ssh

Do update the packages, some prompts might appear.

$ sudo yum update

# Loaded plugins: fastestmirror, security
# Setting up Update Process
# Determining fastest mirrors
# Resolving Dependencies
# --> Running transaction check
# ---> Package abrt.x86_64 0:2.0.8-43.el6.centos will be updated
# ---> Package abrt.x86_64 0:2.0.8-44.el6.centos will be an update
#
# ... will take sometime
#
# Installed:
#   kernel.x86_64 0:2.6.32-754.3.5.el6
# 
# Updated:
#   abrt.x86_64 0:2.0.8-44.el6.centos                                              abrt-addon-ccpp.x86_64 0:2.0.8-44.el6.centos
#   abrt-addon-kerneloops.x86_64 0:2.0.8-44.el6.centos                             abrt-addon-python.x86_64 0:2.0.8-44.el6.centos
#   abrt-cli.x86_64 0:2.0.8-44.el6.centos                                          abrt-libs.x86_64 0:2.0.8-44.el6.centos
#
# Complete!

3. Convert CentOS 6 into Oracle Linux

Good guy Oracle provides us capability to convert CentOS into Oracle Linux easily. They also make the installation process to be soooo easy. For detailed information just take a look at https://linux.oracle.com/switch/centos.

Ok, let's do this. Get the centos2ol.sh file, then execute it.

$ curl -O https://linux.oracle.com/switch/centos2ol.sh 
$ sudo sh centos2ol.sh

# Checking for required packages...
# Checking your distribution...
# Checking for yum lock...
# Looking for yumdownloader...
# Finding your repository directory...
# Downloading Oracle Linux yum repository file...
# Backing up and removing old repository files...
# Downloading Oracle Linux release package...
# 
# ... will take sometime
#
# Dependency Updated:
#   plymouth-core-libs.x86_64 0:0.8.3-29.0.1.el6
# 
# Replaced:
#   redhat-logos.noarch 0:60.0.14-12.el6.centos
# 
# Finished Transaction
# > Leaving Shell
# Updating initrd...
# Installation successful!
# Run 'yum distro-sync' to synchronize your installed packages
# with the Oracle Linux repository.

Then synchronize packages to the current repo by using command below.

$ sudo yum distro-sync

# Loaded plugins: fastestmirror, security
# Setting up Distribution Synchronization Process
# Loading mirror speeds from cached hostfile
# Only Upgrade available on package: sysstat-9.0.4-33.el6_9.1.x86_64
# Resolving Dependencies
# --> Running transaction check
# ---> Package acpid.x86_64 0:1.0.10-3.el6 will be updated
# ---> Package acpid.x86_64 0:2.0.19-6.0.1.el6 will be an update
# 
# ...
# 
# Updated:
#   sos.noarch 0:3.2-63.0.1.el6_10.2
#   system-config-network-tui.noarch 0:1.6.0.el6.3-4.0.1.el6
#   systemtap-runtime.x86_64 0:2.9-9.0.1.el6
#   yum-plugin-security.noarch 0:1.1.30-42.0.1.el6_10
#   yum-utils.noarch 0:1.1.30-42.0.1.el6_10
# 
# Complete!

4. Installing Oracle XE 11g

Download the Oracle Database Express Edition 11g Release 2 for Linux x64 from http://www.oracle.com/.../downloads/index.html. You might need to download it from the browser since the web require us to log in using oracle account (create one if you don't have it).

Copy the downloaded file into our environment base folder (in this tutorial it's ~/Desktop/oracle-linux).

$ tree
.
├── Vagrantfile
└── oracle-xe-11.2.0-1.0.x86_64.rpm.zip

0 directories, 2 files

Later, that environment base folder will be shared and mounted as /vagrant_data on the VM (as per configuration below on the Vagrantfile).

config.vm.synced_folder ".", "/vagrant_data"

The dot . above represent the environment base folder, which is ~/Desktop/oracle-linux.

We already have the Oracle XE installer ready on that path, and since it's accessible from inside the VM, do copy then unarchive it, then perform rpm -ivh command on the extracted file.

$ cd ~/
$ mv /vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ~/.

$ unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
$ sudo rpm -ivh Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm

Now the Oracle XE 11g is installed. Next we need to run the Oracle XE Configuration. In this step few prompts will appear asking certain information like port for Oracle Application Express and for database listener.

One default user will be created, it's SYSTEM user. We'll need to put some password for this user (it cannot be left empty). In this example use MANAGER as the password.

$ sudo /etc/init.d/oracle-xe configure

# Oracle Database 11g Express Edition Configuration
# -------------------------------------------------
# This will configure on-boot properties of Oracle Database 11g Express 
# Edition.  The following questions will determine whether the database should 
# be starting upon system boot, the ports it will use, and the passwords that 
# will be used for database accounts.  Press <Enter> to accept the defaults. 
# Ctrl-C will abort.
# 
# Specify the HTTP port that will be used for Oracle Application Express [8080]:
# 
# Specify a port that will be used for the database listener [1521]:
# 
# Specify a password to be used for database accounts.  Note that the same
# password will be used for SYS and SYSTEM.  Oracle recommends the use of 
# different passwords for each database account.  This can be done after 
# initial configuration: MANAGER
# Confirm the password: MANAGER
# 
# Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
# 
# Starting Oracle Net Listener...Done
# Configuring database...Done
# Starting Oracle Database 11g Express Edition instance...Done
# Installation completed successfully.

Ok, now our Oracle XE is 100% ready.

5. Connect to Oracle XE

Now we need to perform a test, to make sure everything is working fine. We'll connect to the database server from different host.

Previously we configured the private_network property on Vagrantfile. We can use that IP to make sql connection from the host.

Luckily, I already have oracle client installed on my machine, as well as the sqlplus. So I can use that to do the testing. For anyone who doesn't have oracle client ready, just use SQL Developer, it's easy to install and easy to use.

I wrote an article in the past, some port of it teach about how to set up oracle client on linux env, https://novalagung.com/go-oci8-oracle-linux/.

Ok, now lets try to connect to the database server using default user SYSTEM, and using the configured private network ip (192.168.33.10).

$ sqlplus SYSTEM/MANAGER@//192.168.33.10:1521/xe

# SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 3 06:48:54 2018
# Copyright (c) 1982, 2013, Oracle.  All rights reserved.
# 
# Connected to:
# Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

The result is: connected. Now try to perform simple query like getting the database version.

SQL> SELECT * FROM V$VERSION;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE	11.2.0.2.0	Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

Ok, everything is just 👍.

Install Oracle XE on Oracle Linux (Converted from CentOS 6).
Share this