Tuesday, February 22, 2011

Oracle Enterprise Linux 6 in VMWare Workstation

First off, let me say this... UGGHHHH!

Tonight I set out to learn a little about Oracle Enterprise Linux. Download the latest version from Oracle, toss it in VMWare workstation, and give it a whirl! Sounds easy enough... Wrong.

Granted, if you're a linux administrator, you will probably read this and say, "That would have taken me 5 minutes to set up! Newb!"  And you will probably be right.  But I figure there is probably at least one other windows admin out there that will appreciate this information.  Enjoy!

Installing OEL6 in VMWare workstation was fairly straight forward.... until I wanted to install a network card.

Installing VMWare Tools pre-requisites (Setting up local YUM repositories)
Usually the virtual devices can't be seen by the guest operating system (OEL) because the VMWare tools are not installed.  But before we can install VMWare tools, we need to install the pre-requisites...

First we need to tell OEL where to find yum repositories. You won't be able to use the online ones since your network card isnt working. Luck for us, we have the DVD downloaded in ISO format.

1. In VMWare, mount your downloaded ISO to your OEL VM.

2. Create a directory to use as your cdrom mount point.
mkdir /mnt/cdrom

3. Mount the virtual cdrom to the mount point you just created
mount /dev/cdrom /mnt/cdrom

4. Move to the yum repository directory and create a new file. (This tells the yum installer to use local media)
cd /etc/yum.repos.d

vi OEL6.repo


5. Add the following information to the file and save it:

[OEL6]
name=Oracle Enterprise Linux 6 DVD
baseurl=file:///mnt/cdrom/Server/
gpgcheck=0
enabled=1


6. Now tell yum to clean the database
yum clean all

7. Verify you see the local repository
yum list available

You should see lots of packages that are on the OEL6 DVD.  You're all set!

Installing VMWare Tools pre-requisites (Installing kernel, gcc, etc.)

1. Now we need to install a few things for the VMWare tools to install correctly.  Type the following from a command prompt:
yum install kernel-devel kernel-headers gcc mkinitrd

(*HINT* This actually installs headers and development components for the wrong kernel... we fix this in the next section)

Booting a different kernel
It seems OEL6 runs a kernel version that is newer than the headers available on the source media.  I googled a little bit and couldn't find downloadable header files so I had to move to a different kernel.  Luckily, OEL6 includes a RedHat kernel already installed.

1. Modify the bootloader so it uses the alternate RH kernel
vi /etc/grub.conf

2. Change the default setting from 0 to 1

3. Save the file and reboot
shutdown -r -t 0 now

congrats, you are now running the RH kernel.  You can verify this by typing the following command:
uname -r

VMWare Tools

1. Unmount the OEL disc you previously mounted
umount /mnt/cdrom

2. Tell VMWare you are ready to install tools:
In VMWare workstation, click VM and choose "Install VMWAre Tools"
(*Hint* with a windows guest, this usually launches the installer automagically. In linux, this doesn't happen.  clicking this option in VMWare does the virtual equivalent of "putting a CD in the cdrom")

3. Mount the virtual cdrom to the mount point you previously created
mount /dev/cdrom /mnt/cdrom

4. Create a place for your vmware file to unpack
mkdir /home/temp

5. Move to the location you mounted your cdrom and unpack the files
cd /mnt/cdrom/
tar xvfz VMWareTools-8.4.5-324285.tar.gz /home/temp

6. Run the vmware installer
cd /home/temp/vmware-tools-distrib
./vmware-install.pl

the VMware tools "should" install with all default options.  When it is complete, it will kick off the configuration script (/usr/bin/vmware-config-tools.pl) If all of the above steps were completed, it will find all of the necessary kernel headers, gcc, etc.

Installing your network card

1. Edit your network script to bring up your vmware ethernet adapter automagically.
cd /etc/sysconfig/network-scripts
vi ifcfg-etho

2. Add the following:

USERCTL=no
ONBOOT="yes"
BOOTPROTO=dhcp
BROADCAST=
NETWORK=
NETMASK=
IPADDR=


3. Save the file and exit.

4. Modify the other network script

cd /etc/sysconfig/
vi network

5. Make the following additions:
FORWARD_IPV4=yes
GATEWAYDEV=
GATEWAY=


6. Save your changes and exit.

Are we there yet?

1. Move the network scripts folder and "Up" the device.
cd /etc/sysconfig/network-scripts
ifup eth0

If everything worked... you should now have a functioning network adapter.  You can verify by typing the following:
ifconfig

You should see eth0 has a 192.168.xxx.xxx address. Grats!

Conclusion

Holy crap that's a ton of work to get an IP address...

~Brian

4 comments:

Metin said...

Adding this line to /etc/network made my ol6 network run in vmware workstation:
FORWARD_IPV4=yes

Anything else is not mandatory!

Metin said...

my fault, there have been more steps to make the eth0 ipv4 interface work:

1. vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT="yes" # modify line

2. vi /etc/sysconfig/network
FORWARD_IPV4=yes # add line

kind regards
Metin

Steffen said...

mabye you get the correct kernel development and header files with

yum install kernel-uek-devel kernel-uek-headers

this installs the header and development files for the oracle unbreakable enterprise kernel

my system has 2.6.32-100.34.1.el6uek kernel and the vmware tools are builded against that kernel .. the installation stopped with a black screen but after a reboot everything works fine

kpanchan said...

Thanks for post. It is very basic and simple solution to install Network. Last 2 weeks, I was trying to get answer. With your solution, I am able get install my network and other packages from CDROM.