Thursday, December 26, 2013

Working with Virtualbox - getting OEL6 up and running

Like most DBAs, I've used VMWare and VMWare Player for a while to create virtual machines as play pens to test out various Oracle versions, features and generally play around.

I've recently switched to using Oracle Virtualbox, and although I like it I have found it not as easy to get working as VMWare.

I've just created an OEL6 VM and had a few issues, especially around the networking side, so decided to document it. I've done some google searches for the resolution of the issues, so thanks to all the blogs I found.

First, get the latest copy of Oracle Virtual Box - https://www.virtualbox.org/wiki/Downloads

Next, get the latest version of Oracle Enterprise Linux from http://edelivery.oracle.com/linux - note you'll need an Oracle ID. If you don't have one, then get CentOS - http://www.centos.org/modules/tinycontent/index.php?id=30

This is a copy of RedHat, so is OK to install Oracle.

Once downloaded, open Virtualbox and create a new VM. Note that if you type "OEL" into the name field it will automatically select "Oracle" - be careful, I got caught out with this - use the drop-down box to select 'Oracle (64)' otherwise you'll get a message when you try to start it to this effect - "kernel requires an x86_64 cpu, but only detected an i686 cpu". Assuming you have a 64-bit CPU and I expect you do.

I selected the Database Server option, so no GUI desktop. When (if?) OEL6 installs, try a ping to google and see if you can connect to the internet. If you can, then congratulations, you did better than me.

If not, you'll need to go back to the Virtualbox settings and make sure the Network is set to "NAT". Assuming it is, you may need to reconfigure the network in the OS.

Type "ifconfig" and if you only see an entry for "lo" it means you'll have to edit a file.

cd to "/etc/sysconfig/network-scripts" and edit the "ifcfg-eth0" file to look like this:

DEVICE="eth0"
BOOTPROTO=dhcp
HWADDR= (leave this as it is)
NM_CONTROLLED="yes"
ONBOOT="yes"

Save it, then restart the network or the box - "service network restart" or "reboot".

If all goes OK, then try pinging Google again. Mine worked at this stage, if yours didn't then you'll need to look at someone else's blog.

Assuming you can now ping stuff, you'll want to get the latest packages. Also assuming you don't have a subscription to the Oracle Network, you need to set the yum repository to the public oracle one. This changes, so check http://public-yum.oracle.com/ for the latest info.

This page also tells you how to add the repository:

cd /etc/yum.repos.d
wget http://public-yum.oracle.com/public-yum-ol6.repo

This should download a file and then show "saved".

Next, update the packages using "yum update"

It should download the latest stuff. Depending on the version of OEL you installed, it could take a while, and you'll need to enter "y" a couple of times. Once it has downloaded the packages it will update and install them, which could also take a while.

When this has finished, it's probably a good idea to reboot the VM.

Next, you'll want to install the VirtualBox additions (think VMWare tools). You need to do some more yum installs (yeah, I know, thanks Oracle).

yum install kernel-uek-devel

And enter 'y' when prompted.

and

yum install gcc

Then set an environment variable:

KERN_DIR=/usr/src/kernels/`uname -r`-`uname-m`

Click on the menu item "Devices" and then on "Install Guest Additions CD Image". Nothing will happen, you need to mount it on the VM and run the installer.

cd /mnt
mkdir cdrom
mount /dev/cdrom /mnt/cdrom

cd /mnt/cdrom
ls

You should see a list of files. Type

./VBoxLinuxAdditions.run

Hopefully it will install. Mine issued a "FAILED" at the Windows System Drivers but I expected that.

Easy, hey?

Next you'll probably want to enable shared folders so you can copy files into the VM. Shutdown the guest first, then go to the settings, and at the bottom is the "shared folders" item. Click on that, then on the little folder icon with the "+" sign on it and browse to the folder you want to share and add it. Make it auto-mount and give full access. Restart the guest and if you do a "df -h" you should see it listed.

This is not for the VM, but for a 'bare-metal' Linux install. I've put it here because I had to do this a couple of times.

I installed OEL onto a spare PC, then connected an external HDD but got an 'unable to mount' message. To get it to work, I had to add another repository and install an ntfs package:

Go here : http://mirror.optus.net/epel/6/i386/repoview/epel-release.html
and download the "epel-release-6-8.noarch" file (or whichever is the latest). When the system prompts, opt to use the package installer to install it.

When that has been done, open a terminal as root and type

yum install ntfs-3g

This should install the required packages to allow the ntfs drive to be seen.


I'm still struggling with screen resolution, so I'll poke around to see if I have a solution to that.









No comments:

Post a Comment