DBA Tips Archive for Oracle

  


Creating a New Virtual Machine - (CentOS Enterprise Linux 4.2)

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. Host Machine and Virtual Machine Configuration
  3. About CentOS Enterprise Linux
  4. Create a New Virtual Machine for Linux
  5. Optional Virtual Machine Configuration Steps
  6. Install CentOS Enterprise Linux
  7. Install VMware Tools
  8. Backing up the New Virtual Machine



Overview

This article provides the necessary steps to successfully create a new Virtual Machine (VM) using WMware Workstation 5.0 to host CentOS Enterprise Linux 4.2.

Why post an article like this on the Oracle DBA Tips section of my website? Well, the WMware Workstation product provides a unique opportunity for me to have Windows XP (Professional) running on my laptop with the ability to install another operating environment (Linux, Solaris x86, or even another version of Windows) - all on the same machine without the need for dual-booting. VMware provides me with a virtual machine that can run any of the above mentioned operating systems simultaneously with Windows XP on my laptop. I often find it necessary to do new installs or unique configurations of Oracle on Linux while not wanting to disturb my somewhat stable Oracle install on the laptop.

In VMware Workstation, a virtual machine is nothing more than a directory of several files. After creating a virtual machine, (Linux, Solaris, etc.), I typically close down the VM and backup that directory to my NAS. Once this directory is backed up, I have a complete copy of the virtual machine that can be restored at any time. This gives me the ability to install and configure Oracle on the virtual machine without the worry of messing anything up that would otherwise take a long time to fix (or re-install the O/S). When I want to go back to a fresh virtual machine, I simply restore the directory and I am done - back to a fresh install.

As previously mentioned, I prefer to run Windows XP Professional on my main laptop along with the most recent releases of Oracle9i and Oracle10g for Windows on that laptop. I also, however, need the ability to work with different Oracle configurations on Linux and Solaris x86 when I have only my laptop. Although I have several Linux and Sun machines at home, I may be on the road with no access to my vast array of equipment. This is where both VMware and CentOS Enterprise Linux come in handy.

For instructions on installing VMware Workstation 5.0 on to the Windows XP Professional operating environment, see my article entitled "Installing VMware Workstation 5.0 - (Windows XP)".



Host Machine and Virtual Machine Configuration

Before diving into the instructions for creating the new virtual machine, let's first talk about the host machine and operating system that I have VMware Workstation installed on. Also in the table below is the configuration I will be using for the new virtual machine we will be creating in this article. Note that I have a 300GB external hard drive connected to my laptop. While the VMWare Workstation software will be installed on the internal hard drive, (C:), I will be using the external hard drive, (M:), for all virtual machines.

Host Machine
Host Machine Name melody.idevelopment.info - (192.168.1.106)
Host Operating Environment Windows XP Professional
WMware Version VMware Workstation - Release 5.0 (Build 13124)
Host Machine Dell Inspiron 8600 Laptop
Memory 2GB Installed
(The new virtual machine will take 612MB from this 2GB)
Internal Hard Drive 60GB
External Hard Drive 300GB
Processor 2.0 GHz.
File System NTFS
Guest Machine
Virtual Machine Configuration
Guest Operating Environment CentOS Enterprise Linux 4.2
Guest Machine Name vmlinux1.idevelopment.info - (192.168.1.111)
Memory 612MB
Hard Drive 25GB
Virtual Machine Location M:\My Virtual Machines\Workstation 5.0\vmlinux1



About CentOS Enterprise Linux

Although I have used Red Hat Fedora in the past, I wanted to switch to a Linux environment that would guarantee all of the functionality contained with Oracle. This is where CentOS comes in. The CentOS Linux project takes the Red Hat source RPMs, and compiles them into a free clone of the Red Hat Enterprise Server product. This provides not only a free version of the Red Hat Enterprise Linux product, but a very stable Linux operating environment for installing and testing Oracle.

Over the last several months, I have been moving away from Fedora as I need a stable environment that is not only free, but as close to the actual Oracle supported operating system as possible. While CentOS is not the only project performing the same functionality, I tend to stick with it as it is stable and reacts fast with regards to updates by Red Hat. Here is a list of others that perform the same functionality as CentOS:

    White Box Enterprise Linux
    Pink Tie Linux
    Lineox Enterprise Linux

Use the following link to download CentOS Enterprise Linux 4.2:

   CentOS Enterprise Linux



Create a New Virtual Machine for Linux

Finally, we get to actually creating the virtual machine for CentOS Enterprise Linux. The process for creating a new virtual machine is very straightforward given VMware's wizard driven menu system. The following screen shots demonstrate how to create our new virtual machine. Start the VMware Workstation software and choose "[File] -> [New] -> [Virtual Machine]".


Screen 1: - Welcome

The first screen is simply a Welcome screen. Click [Next] to start the virtual machine creation process.


Screen 2: - Select the Appropriate Configuration

The default option in this screen will be to create a [Typical] configuration. Change this option to [Custom] and click [Next] to continue.


Screen 3: - Select a Virtual Machine Format

Keep the default selection of [New - Workstation 5] and click [Next] to continue.


Screen 4: - Select a Guest Operating System

You are now asked for what guest operating system will be installed to this new virtual machine. Although we are using CentOS Enterprise Linux, we will be choosing Red Hat Enterprise Server 4. Remember that these two distributions are identical with the exception of a few logo changes. Choose [Red Hat Enterprise Server 4] and click [Next] to continue.


Screen 5: - Name of Virtual Machine

VMware Workstation uses a user defined name to identify each virtual machine. The default name is the same name as the guest operating system that you chose for the new virtual machine. I typically change this to the server name (host name) I will be using for the virtual machine. For the purpose of this example, my new server name for the virtual machine will be [vmlinux1] so this is what I will type in for the name and the directory. Also note that I am creating the new virtual machine on my external hard drive M:. You can, however, simply leave it to the default. This is a matter of choice and what you want to name the new virtual machine. After deciding on the name for the virtual machine, click [Next] to continue.


Screen 6: - Memory for the Virtual Machine

Both Oracle9i and Oracle10g require a minimum of 512MB of RAM memory although more memory is always better for performance. In my case, I do have the memory to spare and will be giving the new virtual machine 612MB of memory given that I have 2GB of RAM on my laptop. Select the amount of memory you want to dedicate to the new virtual machine and click [Next] to continue.


Screen 7: - Network Type

You are now being asked for the network configuration. I typically keep the default, which is a bridged network. This allows other computers on my network to access the virtual machine. The other option, NAT allows your virtual machine to share the same IP address of your physical (host) machine. Do not select the NAT option as the Oracle installation will fail. The third option, host-only networking, allows only your physical (host) machine access the new virtual machine. If you select this option, other computers on your network will not be able to access the new virtual machine, but the Oracle install will still be successful. After making your network choice, click [Next] to continue.


Screen 8: - Select I/O Adapter Types

I always accept VMware's default option regarding the SCSI adapter to be used and click [Next] to continue.


Screen 9: - Select a Disk

Once again, keep the default option of "Create a new virtual disk" selected and click [Next] to continue.


Screen 10: - Select a Disk Type

You now need to choose a disk type. I always keep the default option which for Linux makes the new virtual disk a SCSI disk. Yes, this works even though you may have no SCSI I/O disks in your system. There is no performance differences by choosing IDE or SCSI here. Keep in mind that the system will only perform to what you actually have installed physically. If you do choose IDE, however, you will be limited to a max of 4 disk that can be attached to the virtual machine. In almost all situations, this will make no difference, but I do like having the SCSI option as it is more flexible to my machine needs. Click [Next] to continue.


Screen 11: - Specify Disk Capacity

Since I will be using this new virtual machine for Oracle, I will need a minimum of around 6GB (O/S files, RDBMS Software and new Oracle Database). Even at 6GB, space is going to be tight. I would recommend somewhere between 8GB and 10GB of space. Although I have the space on my internal hard drive, I will be using the external hard drive connected to my laptop, M:, to store the virtual machine. Using the external hard drive, I now have plenty of spare room and decide to make mine 25GB. By default, the entire space you request here is not immediately allocated. As VMware needs more space for the virtual machine, it will allocate it to the upper limit you supply here. Since I know that I will be using most of the space, I like to pre-allocate this space. You can pre-allocate this space (in my case 25GB) by selecting the check-box "Allocate all disk space now". After selecting the disk size, click [Next] to continue.


Screen 12: - Specify Disk File

WMware Workstation implements a virtual machine by using a disk file. This screen allows you to name the VMware file. It really doesn't matter the name of this file. I do, however, like to change it to the server name of the new virtual machine. Again, this is simply a matter of choice and any name will be fine. Make your selection and click [Finish] to start the creation process for the new virtual machine.


Screen 13: - Creating the disk - Progress Dialog

After hitting the [Finish] button, the virtual machine process begins. If you selected to have the space for the new virtual disk pre-allocated, you will get the (above) [Create the disk] progress dialog.


Screen 14: - New Virtual Machine Created

If everything goes successful, you will have the new virtual machine in your [Favorites] list.



Optional Virtual Machine Configuration Steps

Since the virtual machine I have created will only be used to host Oracle, there are several devices that I can successfully remove from the virtual machine. Having the virtual machine virtualize these unnecessary hardware components is a waste of resources that could be better served with running Oracle.

Some considerations are removing floppy drives and sound cards. In my configuration, I want to remove the floppy drive and audio device. Select [Edit virtual machine settings] and navigate to the device you want to remove. The following screen shot shows how to remove the audio device:


The following screen shows the devices that are configured now for my new virtual machine after removing the audio device and floppy drive:



Install CentOS Enterprise Linux

Now that we have our new virtual machine, the only step remaining is to install CentOS Enterprise Linux to this virtual machine. CentOS Enterprise Linux comes on four CDs. To start, insert Disk #1 of CentOS Enterprise Linux into the physical CD-ROM drive and then power up the new virtual machine. There are several ways to power up the virtual machine:

As I did in the previous section for creating the new virtual machine, I provide all screen shots for installing CentOS Enterprise Linux to our new virtual machine.


Screen 1: - Boot Screen

The first screen is the boot screen. At this point, you can add any type of boot options, but in most cases, all you need to do is press [Enter] to continue.


Screen 2: - Test CD Media

You can choose to verify the CD media in this screen. I know that the ISOs that I burnt to CD were OK, so I typically choose to [Skip] the media check.

After checking your media CDs (or if you are like me and Skip this process), the installer then starts to probe for your video device, monitor and mouse. The installer should determine that the video drive to use is VMware. It will detect the monitor as Unknown (which is OK). It then probes and finds the mouse. Once this process is done, it will start the X Server.


Screen 3: - Welcome

After the installer starts the X Server, you should have the Welcome screen. Click [Next] to continue.


Screen 4: - Language Selection

The installer should choose the correct language by default. Click [Next] to continue.


Screen 5: - Keyboard

The installer should choose the correct keyboard by default. Click [Next] to continue.


Screen 6: - Installation Type

The installer is now asking for the type of Linux install to perform. The best choice here is [Custom]. This will allow us to (later on in the install process) to choose the packages we need for Oracle. When I am going to install Oracle on Linux, I generally choose to install All packages. Choose Custom and click [Next] to continue.


Screen 7: - Disk Partitioning Setup

You now need to select the method to use for partitioning the disk. For virtual machines, I typically choose to perform an Automatic Partitioning method. Click [Next] to continue.

You will be prompted with a dialog asking, "Would you like to Initialize this drive, erasing ALL DATA". Answer [Yes] to this dialog.


Screen 8: - Automatic Partitioning

This is a new virtual machine and there is no data to loose on this drive. Keep the default selection "Remove all Linux partitions on this system" and click [Next] to continue.

You will be prompted with a warning dialog asking to confirm the delete operation. Answer [Yes] to this dialog.


Screen 9: - Partitioning

For most automatic layouts, the defaults should be fine. For example, the space allocated for /boot is always OK at 100MB. The installer will make the Swap space equal to twice the amount of RAM configured for this virtual machine. For my example, this would be 612MB x 2 = 1,224MB. This is more than enough for the Oracle install. The remainder is left for the root file system. So for me, this is a nice layout and I will accept the defaults. Click [Next] to continue.

Starting with RHEL 4, the installer will create the same disk configuration as just noted but will create them using the Logical Volume Manager (LVM). For example, it will partition the first hard drive (/dev/sda for my configuration) into two partitions - one for the /boot partition (/dev/sda1) and the remainder of the disk dedicate to a LVM named VolGroup00 (/dev/sda2). The LVM Volume Group (VolGroup00) is then partitioned into two LVM partitions - one for the root file system (/) and another for swap. I basically check that it created at least 1GB of swap. Since I configured the virtual machine to take 612MB of RAM, the installer created 1,224MB of swap.


Screen 10: - Boot Loader Configuration

The installer will use the GRUB boot loader by default. Nothing needs to be changed here. Click [Next] to continue.


Screen 11: - Network Configuration

You will be making several changes for the network. Most of the settings you make here will, of course, depend on your network configuration. The key point to make here is that the virtual machine should never be configured with DHCP since we will be using this as an Oracle server. You will need to configure the virtual machine with a static IP address. You will also need to configure the virtual machine with a real host name.

To start, click on the [Edit] button for the Network Devices. Click off the option for DHCP and configure a static IP address and Netmask for your configuration:

After completing the above dialog, complete all other network settings and click [Next] to continue.


Screen 12: - Firewall Configuration

On this screen, make sure to select [No firewall] and click [Next] to continue. You may be prompted with a warning dialog about not setting the firewall. If this occurs, simply hit [Proceed] to continue.


Screen 13: - Additional Language Support

Nothing should need to be changed here. Click [Next] to continue.


Screen 14: - Time Zone Selection

Select your time zone and click [Next] to continue.


Screen 15: - Set Root Password

Set your root password and click [Next] to continue.


Screen 16: - Package Group Selection

NOTE: With some RHEL 4 distributions, you will not get the [Package Group Selection] screen by default. There, you are asked to simply [Install default software packages] or [Customize software packages to be installed]. Select the option to [Customize software packages to be installed] and click [Next] to continue. This will then bring up the [Package Group Selection] screen.

This is where you pick the packages to install. If you wanted to simply scroll down to the "Miscellaneous" section and select "Everything", this will install all packages. To simplify the installation, this is the option I typically choose. Doing this, you will get everything required for Oracle, but you will also get many packages that are not necessary for Oracle to install. Having these unwanted packages does not keep me up at night.

If you don't want to install everything, you can choose just those packages that are needed for Oracle. First, ensure that the "Kernel Development Libraries" and the "Development Tools" package are selected. You must have these packages for Oracle to install.

If you will be installing Oracle9i or Oracle10g, then you will need to select the "Legacy Software Development Libraries". Oracle9i and Oracle10g needs the older versions of gcc to compile and it included in the legacy package.


Screen 17: - About to Install

We are now ready to start the installation process. Click the [Next] button to start the installation.

During the installation process, you will be asked to switch disks to Disk #2, Disk #3, and then Disk #4. Click [Continue] to start the installation process.

Note that with CentOS 4.2, the installer will ask to switch to Disk #2, Disk #3, Disk #4, Disk #1, and then back to Disk #4.


Screen 18: - Installation Complete

At this point, the installation is complete. The CD will be ejected from the CD-ROM and you are asked to [Exit] and reboot the system.


Screen 19: - Post Installation Wizard

After the virtual machine is rebooted, you will be presented with a post installation wizard that allows you to make final configuration settings. Nothing really exciting here other then setting the Date/Time and Display settings.



Install VMware Tools

Although this is an optional step, you really should install the VMware Tools for the new virtual machine. From a terminal window on the virtual machine, type in 'su' to become root. Then switch to run level three by typing the following:
# /sbin/init 3
This should put you back to a console. You will then have to login as root from the console.

  If after attempting to switch to run level three, the virtual machine seems to hang, (not giving you a root login prompt), you will have to reboot the virtual machine and perform the tasks in this section in single user mode.

To reboot the virtual machine ensure that the virtual machine has control of the mouse and keyboard, (click the mouse in the virtual machine), and type:

Ctrl-Alt-Insert.

During the boot loader process (Grub), quickly hit any key to stop the automatic boot of the Linux kernel. The default kernel will now be selected in the GRUB configuration window. With the default kernel selected, select 'e' to edit. This will then bring up three boot options. Navigate to the 'kernel /vmlinux-2.6.9-22.EL ro ...' entry (usually the second entry) and click 'e' to edit this entry. The GRUB configuration will then bring up the boot option entry in edit mode and place the cursor at the end of the entry. From here, type in ' single' and hit [Enter].

You are then returned to the GRUB boot option screen with the kernel option you just edited selected. From here, keep the kernel option selected and type 'b' to boot this entry.

The virtual machine will now boot into single user mode - logged in as the root user account.

Now, release your mouse from the virtual machine by typing Ctrl-Alt. From the VMware software, click on the menu option, VM -> Install VMware Tools and confirm by clicking the [Install] button. You will then need to mount the Virtual CD that gets created in the virtual machine using the following:

# cd /tmp
# mount -r /dev/cdrom /mnt
# tar -zxf /mnt/VMwareTools-5.0.0-13124.tar.gz
# cd vmware-tools-distrib
# umount /mnt
# ./vmware-install.pl
When the installation process begins, you can simply accept the default values for the first eleven questions. After that, you are asked for the new screen resolution. You should pick the same screen resolution you selected during the CentOS Enterprise Linux install. After the installation is complete, you must now reboot the machine.
# init 6
When you log back in, you will notice that you no longer have to hit Ctrl-Alt to move between the virtual machine and the host operating system. Also, you will see that the mouse works more smoothly.



Backing up the New Virtual Machine

Now that you have your new virtual machine configured and working, this would be a good time to back it up. This is a very straightforward process as the virtual machine is nothing more than a few files in a directory.

The first step is to shutdown the virtual machine. You can power down the virtual machine by simply shutting down Linux. I also like to completely close out VMware before starting the copy.

Once this is done, simply backup the appropriate files as shown below:

C:\> dir /A-R "M:\My Virtual Machines\Workstation 5.0"
 Volume in drive M is Backup
 Volume Serial Number is 00F1-0AAB

 Directory of M:\My Virtual Machines\Workstation 5.0

11/20/2005  03:18 PM    <DIR>          .
11/20/2005  03:18 PM    <DIR>          ..
11/20/2005  11:42 AM    <DIR>          vmlinux1
               0 File(s)              0 bytes
               3 Dir(s)  48,510,427,136 bytes free

C:\> mkdir "N:\Virtual Machine Backups\vmlinux1"

C:\> xcopy "M:\My Virtual Machines\Workstation 5.0\vmlinux1" "N:\Virtual Machine Backups\vmlinux1" /s /e
M:\My Virtual Machines\Workstation 5.0\vmlinux1\rhel4.nvram
M:\My Virtual Machines\Workstation 5.0\vmlinux1\rhel4.vmsd
M:\My Virtual Machines\Workstation 5.0\vmlinux1\rhel4.vmx
M:\My Virtual Machines\Workstation 5.0\vmlinux1\vmlinux1.vmdk
M:\My Virtual Machines\Workstation 5.0\vmlinux1\vmlinux1-flat.vmdk
M:\My Virtual Machines\Workstation 5.0\vmlinux1\vmware.log
6 File(s) copied


Copyright (c) 1998-2014 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Saturday, 18-Sep-2010 17:56:29 EDT
Page Count: 24777