Today in this article we will install and configure Oracle Linux 6.7 for Oracle Database.
For this purpose I recommend use Oracle VM VirtualBox, it's a free virtual machine tool and is totally compatible with almost all platforms of Operating Systems (Windows, Linux and Mac).
1. Open your VM VirtualBox Manager, click "New" --> Type --> Linux, Version --> (Oracle 64-bit):
PS: You can choose Oracle-63bit or Oracle-64bit, it will depend if your processor has the option: Intel VT or AMD-V (Virtualization Hardware). Check it on BIOS, if isn't enabled you will only be able to select 32bit OS versions.
2. Select the total amount of memory that you want to use in your VM (Virtual Machine):
3. Choose option "Create a virtual hard drive now":
4. Select "VDI (VirtualBox Disk Image):
5. Create a "Dynamically allocated" disk:
6. We will use this first disk to install and configure the Operating System, set the size to 100G:
Creating a "Dynamically allocated" disk, give us flexibility to set a huge size of disk. But doesn't mean that it will allocate this space on your physical hard drive. As you can see, after create the disk the space of the hard drive on your physical machine is the same. The space it will be allocated just when you really use.
7. Let's edit some configurations: Settings --> Network --> enable adapter 1 as NAT, and enable adapter 2 as Host-only:
Enabling NAT (Network Address Translation) it will translate every request to the internet from your physical network. In other words, you will be able to use internet connection inside of your virtual machine.
Enabling Host-only adapter, you will be able to connect from your physical machine to your virtual machine through TCP/IP protocol, using for example some SSH client (putty, bash, ksh...).
8. We will need add more disks to install the Oracle Database, in the next steps I will guide you how to add these disks (DATA, REDO and ARCHIVE).
In the settings of your VM (Virtual Machine), select the option: Storage --> Controller: SATA --> Add Hard Disk --> Create new disk:
Create this new disk as "Dynamic allocated" with 50GB of size, it will be the disk to use in the "DATA" diskgroup when we install and configure "Oracle Grid Infrastructure for a Standalone Server".
Repeat the same step to add REDO (10GB) and ARCHIVE (20GB) disk, at the end you will have 4 hard disk in your VM:
9. Now it's time to choose our image (.iso) to install our Operating System: OEL 6.7
9.1 There is one last setting to be done about the ''Host-only" network configuration:
This settings will enable us to connect to the VM from our physical machine.
You can download Oracle Linux from "Oracle Software Delivery Cloud", for purpose of studies you don't need to pay and you need to use a previous created account (It's free to create if you don't have one).
10. Starting VM select the first option "Install or upgrade an existing system":
10.1 In the next step you will be prompt to select if you want to scan the media that was inserted on media player of VM "OK" or "Skip", you don't need to scan (It take a very long time to complete), because scan it will try to find some physical problem on media and we are using a disc image (.iso):
10.2 Welcome to Oracle Linux installation steps: Next -->
10.3 Select the language that you want to use during the installation process, then: Next -->
10.4 Select your keyboard layout:
10.5 We will not use SAN (Storage Area Network), it will be a simple hard disk (SATA), select "Basic Storage Devices":
10.6 It will appear a warning message about clear your device and loose some data if there is some: "Yes, discard any data":
10.7 Set a Hostname --> Configure Network --> Edit eth0 device --> "Check box" --> Connect automatically --> Set "Automatic DHCP":
10.8 Edit settings of eth1 device, Configure Network --> Select eth1 device --> Edit --> Check box "Connect automatically" --> Set "Manual" IP --> Next:
10.9 Select your territory/Time Zone, check box "Sytem clock uses UTC" if you are gonna use "Coordinated Universal Time", Next:
10.10 Set up a root password:
10.11 In the next step select "Create Custom Layout", this option will enable us to create the file systems and edit the partitions of disks:
10.12 Select the first disk (/dev/sda), we will create and configure some partitions:
- /boot (200MB) -----> Non LVM
- Swap (7GB) -----> LVM
- /opt/oracle (30GB) -----> LVM
- /backup (30GB) -----> LVM
- / (10GB) -----> LVM
- We will leave some free space to resize some file system in the volume group if need it in the future.
Select /dev/sda, Create --> Standard Partition, "Allowable Drives" keep just sda selected, ext4 partition type, size 200MB, Fixed size --> check "Force to be a primary partition":
The /boot partition it will be the unique partition to resides out of LVM, because contains the kernel image to start the operation system and other processes like LVM software.
10.13 Select the "Free" space of /dev/sda disk, now create "LVM Physical Volume", again keep just sda disk selected, select "Fill to maximum allowable size".
We will use the entire disk to create this volume group and create each partition:
10.14 Click "Add", select "swap" on "File System Type" menu list to create a Swap partition, 6GB size, I prefer to give a custom name to identify easily each lvm partition (lv_swap, lv_ora_bin, lv_root, lv_backup...), repeat this process to every partition that you wish create, but in the next partitions the "File System Type" it will be ext4 format:
As you can see each LVM partition it's in ext4 format and I indicates each "Mount Point": /opt/oracle (Install Oracle binaries), /backup (Perform disk backups, / (It will be used to install our Operating System).
I am using /opt/oracle to install Oracle binaries, because /opt directory in the Filesystem Hierarchy Standard (FHS) it's was designed to install/store applications on Linux.
You can choose another directory to install your Oracle binaries, like /u01 that it's used a lot in the "Oracle Documentation".
10.15 At the end you will have the follow "Custom Partitions": Next -->
We won't use the other disks now, I will show you how to format these disks and create an Udev rules for "Oracle ASM (Automatic Storage Management)": "About Udev Rules".
11. Now it's time to perform the last configurations, selecting "Basic Server" --> "Customize now" --> Next --> "Servers" --> check "System administration tools" --> "Optional packages" --> Select "oracle-rdbms-server-12cR1-preinstall-1.0- 14.el6.x86_64" and "oracleasm-support-2.1.8-1.el6.x86-64" --> Close --> Next:
Selecting these two packages we will not need setup any kernel parameters, limits and create oracle user and groups. It's a "preinstall" packages that perform almost everything with at least the minimum values of these parameters and perform dependencies packages installation.
11.1 Initializing the Operating System, you can choose one of two options of the kernel to startup your system. Select the first one "Oracle Linux Server Unbreakable Enterprise kernel", to understand a little bit of unbreakable kernel check this link: "Unbreakable Enterprise Kernel Release 3".
12. We will start prepare our system to receive an Oracle Database installation, access the system using root user.
Let's perform some basic configuration on the Operating System:
- Edit file /etc/ssh/sshd_config --> uncomment line "#UseDNS yes" and change to "UseDNS no"
- In the same file search for "GSSAPIAuthentication yes", comment this line and uncomment "#GSSAPIAuthentication no"
- Restart SSH service: service sshd restart
- Disable Iptables firewall: service iptables stop and chkconfig iptables off
- Edit file /etc/selinux/config --> change "SELINUX=enforcing" to "SELINUX=disabled"
- Change oracle user password in the Operating System: passwd oracle
- Change owner of the /opt/oracle and /backup mount points: chown -R oracle:oinstall /opt/oracle, chown -R oracle:oinstall /backup
- Edit file /etc/fstab, change "tmpfs" entry line as below:
tmpfs /dev/shm tmpfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=6G 0 0
- After editing /etc/fstab, execute: mount -o remount tmpfs
The image below illustrates how your initial file systems and mount points should look like:
Disabling "UseDNS" and "GSSAPIAuthentication", it will allow SSH connection requests to respond more fast.
To learn a little bit more about SELinux, check this link: (Security Enhanced Linux).
Altering "tmpfs " entry on /etc/fstab it will increase the size of "Shared Memory".
12.1 We need to add our "Host-only" IP in the file /etc/hosts, but in a production environment this step isn't necessary because we should use DNS (Domain Name System) to name resolution.
Check below how it should look like:
13. Now we will create the Udev rules to configure owner and permissions on each disk to use in the next post to configure Oracle ASM: /dev/sdb1, /dev/sdc1 and /dev/sdd1:
13.1 Create a new file: vi /etc/udev/rules.d/99-oracle.rules with the following contents:
- KERNEL=="sdb1", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"
- KERNEL=="sdc1", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"
- KERNEL=="sdd1", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"
The "KERNEL" parameter indicates which device you want to set up the rules, "OWNER" parameter indicates who it will be the owner of this device and "MODE" parameter indicates which permissions this device it will have.
Now we will create a new table partition, repeat this process on each disk:
13.2 To check if our rules were successfully applied: ls -l /dev | grep -i ora
You should see each new table partition with the right owner, group and permissions, these permissions are persistent. Even if the Operating System reboot, after startup the system, these rules it will be right:
14. We are almost done, now reboot the Operating System to take effect in the SELinux configuration that we made and finish!
See you in the next post!