Set up DB2 Enterprise 9 on a Linux virtual machine using VMware ESX Server
There are a number of reasons why you might want to set up DB2 9 on a virtual machine. For example, you may need to consolidate your servers and make full use of the hardware your company has already purchased. Or, maybe you are trying to set up a test environment that needs to be completely isolated from the production environment. Or perhaps you are trying to test out legacy applications on new operating systems.
If you find yourself in any of these situations, then this article should prove to be a handy reference. We will walk you through setting up a Red Hat Linux (64-bit) virtual machine using VMware ESX Server, and then continue with details on installing DB2 Enterprise 9 64-bit in that image. This article also provides you with tips and techniques on configuring your newly created image and discusses some of the possible configurations or scenarios that you could plan for using the VMware ESX Server product.
The examples use the following software:
- VMware ESX Server 3.0.1
- Virtual Machine
- Red Hat Enterprise Linux 4
- DB2 Enterprise 9
- VMware Virtual Infrastructure Client 2.0
- DB2 Client 9
VMware Infrastructure components
The VMware Infrastructure (VI) suite is an infrastructure virtualization software that allows you to virtualize storage, networking and servers. Apart from the main virtualization functionality provided by the ESX Server product, VI suite also contains products for high availability (VMware High Availability), resource balancing (VMware DRS), migration of the virtual machines (VMware VMotion), consolidated backup of the virtual machines (VMware Consolidated Backup), and so on.
Figure 1 (source: VMware Quick Start Guide) shows the basic components of VMware Infrastructure 3. In this article we will be implementing the ESX Server host and the Virtual Infrastructure Client components.
Figure 1. VMware Infrastructure
VirtualCenter Management Server: This component is set up on a remote Windows® machine, where the administrator can manage several virtual machines and ESX Server hosts. It offers a single point of control over all the ESX Server hosts, with functionality such as managing permissions, access control, and performance monitoring.
Database: The VirtualCenter Server component uses a database to store configuration data for the entire infrastructure. This component is not needed if the VirtualCenter Server is not being used and there is a one-to-one connection between the VI Client and the ESX Server host.
ESX Server hosts: These are the host machines on which virtual machines are created. The administrator can control the distribution of the physical host's memory, CPU, storage and other resources among the different virtual machines. This component allows you to create a VM, install the OS, configure resources, and set up applications within the virtual machines.
Virtual Infrastructure Client: This client can be used to manage virtual machines. It can be used as a console for a virtual machine and connect to a single standalone ESX Server host, or if it is connected to the VirtualCenter Server, then it can be used to remotely administer multiple virtual machines created over multiple ESX Server hosts.
Web Browser: The Web browser allows you to download the VI Client from the ESX Server host or from the VirtualCenter server.
License Server: This component is set up for storing and managing the licenses needed to maintain a VMware Infrastructure. Licensing is implemented in two different ways: either host based, where each ESX Server host stores its own license files; or license-server based, where the License Server stores and manages licenses for the ESX Server hosts.
VMware ESX installation and setup
VMware provide information on their Web site to assist in installing and configuring the VMware Infrastructure and ESX server. Particular attention needs to be paid to the systems compatibility guides. ESX server is only supported on and is compatible with a specific range of hardware devices. For more information see the VMWare Virtual Infrastructure documentation .
Create a new Virtual Machine and Guest OS installation and setup
In this article we will use the terms VM and Virtual Machine interchangeably.
Working in the VMware Virtual Infrastructure Client, select File > New > Virtual Machine, or press Ctrl +N to start the wizard.
Figure 2. New Virtual Machine
The first page in the wizard gives you the option of doing a typical or custom installation. In most cases a typical installation should suffice. However, there may be occasions when you want to add additional virtual hardware devices to the VM or to change configuration parameters. In this case you could choose customer setup.
Once you have chosen your preferred method for setting up the VM, you are then guided through the following options which we will look at in more detail:
- Datastore (the location where the VM will reside)
- Guest operating system (Windows, Linux, Solaris, Novell Netware, or another OS)
- The number of CPUs the VM will use. This will depend on the ESX server licensing options you have.
- The amount of memory that will be assigned to the VM
- Network card assignment
- Virtual disk size
You will be prompted for the datastore where the VM will reside. The datastore is the storage location that is defined during ESX installation and can be a VMFS volume, NAS or an iSCSI volume as shown in Figure 3.
Figure 3. Datastore selection
The next step is to select the operating system you will install on the VM. The Supported Environments-DB2 9 site gives complete details on the recommended and validated environments for DB2 9 on Linux.
For a full listing of ESX Server supported guest operating systems, please see the Systems Guide.
Figure 4. Guest OS selection
Next, select the number of CPUs your VM will use. This is dependent on the number of physical processors the host has, as well as the ESX licensing options you have chosen.
Figure 5. CPU selection
Next, select the amount of memory that will be assigned to the VM. As with CPU selection, this is dependent on the amount of physical memory the host has. The VM setup wizard gives recommendations on the minimum and maximum memory that can be used, as well as recommendations for best performance.
Figure 6. Memory selection
Next, select the number of network cards you want the VM to use.
Figure 7 Network Card Selection
You can now select the size of the virtual hard disk. The size that can be selected is dependent on the amount of space in the datastore you selected.
Figure 8. Virtual disk capacity
The final screen in the wizard gives you a summary of the options selected. You are now ready to create the virtual machine and install Redhat Enterprise Linux 4 64-bit. Select Finish, and ESX server will create the virtual disk and the virtual machines configuration files.
Figure 9. VM setup summary
You are now at the point where you can install your guest operating system. Installing your guest operating system is the same as installing it on physical hardware. However, there are a number of ways you can use the OS installation media.
You can use a physical CD or DVD located in the hosts CD/DVD drive, an ISO image or a client device. Figure 10 shows the three options in the VM setting panel.
The first option, client device, allows you to use the CD/DVD drive on your desktop PC or laptop to install the operating system. The second option allows the VM to use the host's CD/DVD so you have to have your installation media for the operating system in the host drive. The third option allows you to use an ISO image of the install media. You would typically upload the ISO files to the datastore location on the ESX server, for example /vmfs/volumes/storage1. You can select the browse button to locate the ISO files when needed.
Figure 10. CD/DVD settings
When you have selected your desired method for using the installation media, click the Start button, and the VM will boot up.
Figure 11. Start VM
Figure 12. Install Guest OS
Figure 13. Guest OS installation complete
You are now ready to configure the VM.
Virtual Machine configuration
In this section we will highlight some basic examples of configurations tasks you can perform after creating a virtual machine:
Enable virtual machine's Telnet and FTP services
In the virtual machine's Linux command window, change directories to
/etc/xinetd.d and edit both the krb5-telnet and gssftp files to change the values of DEFAULT and DISABLED keywords to:
# default: on
disabled = no
Once you have edited and saved the files with the default on and disabled = no, restart xinetd as follows:
Wait for the xinetd process to be restarted. Then, retrieve the IP Address of the virtual machine using the ifconfig command and try to telnet into your virtual machine from a remote machine.
VMware Tools is a set of utilities that, once installed, provide you with functionality to synchronize time between the virtual machine and the service console, list and connect to the devices available to the VM, copy and paste data between the guest and host OS ,only when guest OS is Windows, as well as manage scripts which can be automatically run every time the power state of the VM is changed among other functions. In the Virtual Infrastructure Client GUI, Inventory view, right click on your virtual machine and select
Install VMware Tools option.
Virtual Machine Properties Editor
This screen allows you to change characteristics of the newly created virtual machine. You can change the VM's hardware configuration, sound settings of the VM's guest OS, resource settings such as CPU, memory and disk IO bandwidth allocation, and so on. For e.g. our virtual machine was allocated 1024 MB memory, to add more memory use the slider bar or manually enter a memory value, hit OK and then power on the virtual machine for the changes to take effect.
Figure 14. Virtual Machine Properties Editor
DB2 9 Installation
Once the guest operating system has been installed and configured, we can proceed to install DB2 ESE v9.1 into the virtual machine. The steps for installing DB2 into a virtual machine are no different than installing it on a physical Linux box. The installer can be started by running
db2setup from the command line.
Figure 15. DB2 setup
Once DB2 has been installed and the instance has been created successfully, you can go ahead and log in as the instance owner, in this case db2inst1, and then invoke the db2profile script to set environment variables. The sample database can be created using the db2sampl script.
To open up the DB2 Control Center, remember to add access to the X Server by issuing
xhost + as the root user. Then log back in as the instance owner and start the DB2 Control Center as shown in Figure 16:
Figure 16. DB2 Control Center
Now that you have installed DB2 in the virtual machine and created the sample database, you can go ahead and catalog this database on a remote DB2 client. On the remote client machine, start the DB2 Configuration Assistant and use the
Search the network option of the
Add Database using Wizard option. The instance and database, created in our virtual machine, can be discovered and catalogued for remote connectivity. The IP Address provided for the Host Name field will be the IP address of the virtual machine.
Figure 17. Connecting remotely
Where to go from here
VMware provides a natural isolated environment within which you can test changes to configuration parameters without risking the actual host environment. There are also a number of other VMware products that can further enhance the usability and manageability of your VMware environment:
Virtual Center provides an environment whereby you can provision, monitor and manage your virtualized environment through a single interface. You can:
- Automate routine management tasks with task scheduling
- Monitor performance and utilization of physical servers and the virtual machines they are running
- Simplify the deployment of new virtual machines
VMware Lab manager allows you to create multi-machine configurations using templates. You can set up machines in a configuration to boot in controlled sequence. In addition, you can work on virtual machines as a single unit, allowing you to shut down, suspend, turn on, turn off, reset, deploy, undeploy, clone, and modify properties
Further information on the various additional VMware products can be found at http://www.vmware.com/products/home.html.
When you have DB2 installed, you will want to tune the database and instance for optimal performance. The articles mentioned in the Related topics section should provide a good starting point for tuning your database.
VMware ESX server provides a robust and scalable solution to server consolidation and datacenter costs. It offers an efficient way to manage an increasing number of servers in your environment and it offers the DB2 user and developer an environment in which to develop applications and databases on a number of platforms with minimal cost compared to physical servers.
- VMware Web site: Official Web site of VMware
- VMware Virtual Infrastructure Documentation: Get more details on VMware.
- "Scaling IBM DB2 9 in a VMware Infrastructure 3 Environment": This article provides more information about using DB2 with VMware.
- "DB2 tuning tips for OLTP applications": Tune DB2 for the OLTP environment.
- "Top 10 performance tips": This article lists basic tips for tuning DB2 performance.
- "DB2 V9 performance guide": Refer to the product documentation for more performance tuning details.
- Download a free trial version of DB2 Enterprise 9.
- Now you can use DB2 for free. Download DB2 Express-C, a no-charge version of DB2 Express Edition for the community that offers the same core data features as DB2 Express Edtion and provides a solid base to build and deploy applications.
- Visit the developerWorks resource page for DB2 for Linux, UNIX, and Windows to read articles and tutorials and connect to other resources to expand your DB2 skills.
- Learn about DB2 Express-C, the no-charge version of DB2 Express Edition for the community.