I have a confession to make. I have not been into Linux very much. When I started my career at Oracle, back in 1994, I had to do a little bit of development work on a UNIX machine. That’s where I acquired from cd, vi, sed, grep and ls skills. But in later years, on my own laptop, I took the easy way out and succumbed to Windows and GUIs. Then I started using Virtual Machines and even they had Windows as their client operating system most of the times. I have occasionally downloaded Linux based VMs from OTN – and used as the server side in my development efforts quite happily – and I was supplied with such Linux VMs by several very helpful colleagues no many occasions, for example for doing the work in the various beta-programs AMIS is involved in. But I was a little scared of Linux if truth be told. And the idea of creating a virtual machine by myself seemed preposterous.
Then the world changed. Primarily because of a colleague who in so many words told me to get a grip. And of course he was right. And the release of Oracle Database 12c on Linux only (!) was another big stimulus. And after a few days of struggling, googling an frantically asking around, I have managed to get Oracle Database 12c running in Oracle Enterprise Linux 6.4 based Virtual Box VM. I feel like I am on top of things. And in hindsight – it was not such a big deal. My decade of hesitation was quite unjustified.
In this article I would like to show you how I got over my threshold – that seemed so high from one end and turned out so low from the other. Here is how you can get a Virtual Box VM going on OEL in less than one hour.
The steps are:
- Download and install Virtual Box (nothing special, just run the install wizard)
- Download the Oracle Enterprise Linux 6.4 ISO image (3,5 GB) Note: you can pick other Linux distros as well; not however that Oracle Database 12c and onwards will not be available for 32 bit Linux!
- Create a Virtual Machine in Virtual Box – provide a name, the intended operating system, some details about the initial hard disk, configure network properties (I am still struggling a bit here)
- Attach a new DVD device – based on the ISO image
- Start the new Virtual Machine; the ‘DVD’ will run the installer for OEL
- Instruct the installer wizard what to install (include for example the graphical desktop – sorry, I cannot help myself)
- Complete the installer
- Reboot the VM and login => the new VM is done
- Post installation steps
- Export appliance to have it available for reuse
In somewhat more detail:
1. Download and install Virtual Box
Go to http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html and download Virtual Box. Then run the installer. No special settings are required.
2. Download the Oracle Enterprise Linux 6.4 ISO image
Go to https://wikis.oracle.com/display/oraclelinux/Downloading+Oracle+Linux and select a mirror to download the ISO image from.
Just save the file somewhere on your disk.
3. Create a Virtual Machine in Virtual Box
Click on New.
Type the name of the new VM and select the operating system for the machine – Linux and Oracle (64 bit) respectively:
Set the memory size (something you can easily adjust after creating the VM):
Time to define the storage under our new machine. Select the option to create a virtual hard disk now:
Specify Dynamically Allocated – which basically means that the file created on your host to implement this virtual disk will only grow to its final size when in the VM the disk space is actually allocated.
Provide a Name and specify a Size for the disk. Because of the dynamic allocation, I have now qualms about increasing the size of the disk a little. This is something you can not adjust later on – even though you can multiple disks to your vm.
The definition of the VM is presented:
Now comes the part I have been struggling with a lot. The network. I have used the following step – yet whenever the host is not on line, I do not seem to be able to connect to the host from the guest (the vm) or vice versa (connect to the guest from the host). I have also had the problem that the IP address in the host kept changing all the time – making it also impossible to establish a good connection from the host to the guest. My instruction here may not be the final answer: click on settings. Go to Network and change from the default (NAT) to Bridged Adapter:
Open the Advanced section and set Promiscuous Mode to Allow All. Note: the name of the adapter depends on whatever network adapter is available in host.
By default, the Network adapter is created in NAT configuration. This is OK for client machines, but we want to use our VM as a server, so we have to change this into the Bridged adapter.
Next, go to the Storage tab.
4. Attach a new DVD device – based on the ISO image
On the storage tab in the settings dialog, you will see the hard disk we have created earlier on. We now also want to specify a DVD Device. One that is based on the ISO image. This means that the virtual machine will behave as if a DVD player was attached to the ‘computer’ with the Linux Installation DVD loaded and on auto-start. Click on the Add CD/DVD device icon:
Click on Choose Disk in the next dialog:
Select the .ISO file with the OEL 6.4 install image that you downloaded earlier on
The settings dialog is updated with the DVD device:
5. Start the new Virtual Machine
Click on Start
the ‘DVD’ will run the installer for OEL
6. Instruct the installer wizard
Check the checkbox to Connect Automically:
Select your location (timezone):
Specify the root password:
Because we are using a new, fresh hard disk we can just use all space. If you mark the checkbox Review and modify partitioning layout, you get an overview of how the installer intends to organize the logical volumes and volume groups:
You do not have to make any changes. Click Next, and after the next screen, click next again.
Accept the next dialog – to write changes to disk (as the disk is still fresh and empty):
Select the type of installation, such as Software Development Workstation:
Make sure the following packages are selected under the category Desktops if you want to have the graphical GNome desktop:
Click on Next. The dependencies are checked.
Now the installation will start.
7. Complete the installer and have the installation run
a lot of packages have to be loaded…
For me it took about 20 minutes.
You next enter the post install wizard (no big decisions, mainly the creation of a new (non-admin) user, for example oracle.
Create a new user:
The system will now reboot.
8. First check and Final post installation configuration steps
After starting up, the following dialog is shown:
Click on user oracle and login with the password set up for that user.
Try to run Firefox – using the icon in the top bar:
If it works, the network adapter eth0 is indeed connected.
Disable the firewall – because this will be a local machine that we probably want to be able to access from the host and other virtual machines:
You may have to provide the root password to perform this operation. In the next screen, click the big disable icon:
and accept (click Yes) the next dialog:
The VM is now set up, ready for use. For example to install Oracle Database 12c – which will be my next step.
Note: Tim suggests a final step: Disable SELinux by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows. I am not sure what exactly that entails. It may be a good idea.
edit on June 30th 2013:
8b. Configuring the Host-Only Network
Using Marco’s kind suggestions I was able to establish the connection between the host and the guest VM. Like he said, it was pretty straightforward.
In the Virtual Box Preferences, the Network tab presents information about Host-Only Networks. I added one, but the default one served me fine.
I inspected the properties of the default adapter:
This IP address, like Marco said, is the address where the guest VM can access the host.
The DHCP Server tab explains how the Virtual Box DHCP Server for the host only networks dispenses IP addresses. By default, it starts at 192.168.56.101 – the address that will be assigned to the first VM started up with a host only network adapter.
Now on to the configuration of the VM itself. In addition to the first network adapter – set to bridged to allow the VM to access the rest of the world – a second adapter is set up for the VM. This one is of type Host-only Adapter and refers to the default Virtual Box Host-Only Ethernet Adapter.
When next the virtual machine is started, I checked the network situation using the ifconfig command:
The guest VM has been assigned the 192.168.56.101 IP address through its eth1 network connection. This connection by the way can be checked as well:
and its properties are:
Finally, on my Windows host machine I would like to refer to the VM by hostname rather than IP-address. I have edited the WINDOWS/system32/drivers/etc/hosts file and added a line for the IP address 192.168.56.101. Note however that if multiple VMs are started and they are started in a different order, the IP-addresses will be allocated differently.
After saving this file, I started a new command line window and pinged for host orcl12c:
9. Install Guest Additions
Some interesting interactions between host and Virtual Box vm are available when the Guest Additions are installed in the Linux VM. This can easily be done using the following procedure.
In the Virtual Box Devices menu, select the option to Install Guest Additions. This will make Virtual Box attach a DVD device to the VM that will then popup and propose autorun. Accept all dialogs to make the guest additions enabled in the VM.
Now you can enable a shared clipboard between guest and host:
10. Export the VM appliance, to have it available for reuse
The VM we have constructed now, is a perfect starting point for future environment, such as Oracle Database, various Oracle FMW components, Java EE 7 development work etc.
Progress indication is a little flexible..
The final result is a reusable, shippable file:
Download VirtualBox: http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html.
How to Install Oracle VM VirtualBox and Create a Virtual Machine – http://www.thegeekstuff.com/2012/02/virtualbox-install-create-vm/
Downloading Oracle Linux – https://wikis.oracle.com/display/oraclelinux/Downloading+Oracle+Linux. One of the mirrors where ISO image for OEL 6.4 can be downloaded: http://ftp5.gwdg.de/pub/linux/oracle/OL6/U4/x86_64/
Install Oracle Enterprise Linux in Oracle Virtual Box VM – https://blogs.oracle.com/jaapr/entry/sun_ray_server_on_oracle
Using VirtualBox Host-only Networking to run servers in your lap – https://blogs.oracle.com/fatbloke/entry/virtualbox_vms_with_multiple_vnics
Tim Hall’s instruction on installing Oracle Linux 6: http://www.oracle-base.com/articles/linux/oracle-linux-6-installation.php
Tim Hall’s instructions on installing Oracle Database 12c on top of Oracle Enterprise Linux 6: http://www.oracle-base.com/articles/12c/oracle-db-12cr1-installation-on-oracle-linux-6.php