Tuesday, 28 July 2020

Preparing the Linux VM for Oracle DB installation

This posting is part of my Oracle DB Developers VM series. Based on the previous postings on how to set up Oracle Linux 8 on VirtualBox, this post will show how to prepare the Oracle Linux 8 VM for the installation of Oracle DB 19.3 on a beginners level.
First we need to allocate space for the Oracle software installation and database files. Following the Oracle Optimal Flexible Architecture, all Oracle software and data should be stored on volumes mounted to /u01, /u02 ... etc. For our dev system, we will put everything on one volume mounted under /u01, that needs to be created under VirtualBox first.
Shut down your VM first, if running. In the VirtualBox Manager, open the settings for your VM and go to the Storage section. Select the virtual SATA controller and click the icon to add a hard disk.
Click the button to create a new disk image.
 Accept the defaults on the first two pages of the wizard.
On the 3rd page, change the file name to something meaningful and make the disk as large as you like. It won't allocate much storage on your drive, as it is a dynamically allocated volume.
Select the newly created disk and click Choose.
The new disk should be listed in the list of connected storage devices. Now start your VM.
First assure that the new disk is visible to the OS by running a sudo fdisk -l . Your disk should be listed as /dev/sdb like shown above.
Next use fdisk to create a partition.  Run sudo fdisk /dev/sdb, n for new partition, accept all the defaults and w to write all changes to disk.
Now if you re-run sudo fdisk -l it should list partition 1 on /dev/sdb that we have just created as /dev/sdb1.
We now can format that partition. I always go with ext4 unless I have a very good reason to choose something else. All the other file systems have their strengths, but these mostly don't pay off in such a development VM. Run mkfs.ext4 /dev/sdb1 and accept all defaults.
Mount the volume with the following

sudo mkdir /u01
sudo mount /dev/sdb1 /u01
sudo chown oracle:oinstall /u01
touch /u01/asdf
ll /u01/

Now that the oracle user has access, let's make that mount permanent
Run sudo vi /etc/fstab and add the following line:

/dev/sdb1  /u01   ext4 defaults 0 0

So much for the file system, now lets configure networking. As this VM is intended to be run on a system that is already protected by a firewall, the Linux firewall can be switched off by typing

sudo systemctl stop firewalld
sudo systemctl disable firewalld

Set the hostname to something meaningful with

sudo hostnamectl set-hostname orcldevvm-ol8
hostnamectl
In VirtualBox Manager, check your IP range for the host-only network by clicking File|Host Network Manager...
So the VM's IP address will be from the 192.168.56.1/24 network. To find out the address, switch to your VM and type

ip address
The only IP address in that range is in my case the 192.168.56.104. This might differ in your installation, note this address. For the next steps, is important to use this address because later we will bind the Listener to that address so you can use your tooling from outside the VM if you want.
Edit /etc/hosts and add a line with this address and the hostname, eg.
For convenience, also add the hostname to your host OS, eg. for Windows use your favorite editor in admin mode and edit C:\Windows\System32\drivers\etc\hosts
To skip many other manual setup tasks, install the oracle-database-preinstall-19c.x86_64 package via

sudo dnf install oracle-database-preinstall-19c.x86_64
Answer y and wait until the packages are installed
So much for the pre-installation tasks. The VM is ready for an Oracle installation.