How to Use Oracle VM Templates

by Yuli Vasiliev

Published June 2012

How to prepare an Oracle VM environment to use Oracle VM Templates, how to obtain a template, and how to deploy the template to your Oracle VM environment.

This article describes how to prepare an Oracle VM environment to use Oracle VM Templates, how to obtain a template, and how to deploy the template to your Oracle VM environment. It also describes how to create a virtual machine based on that template and how you can clone the template and change the clone's configuration. As an example, the article uses a template for Oracle Database that contains two disk images: an Oracle Linux system image and an Oracle Database image.

About Oracle VM Templates

Virtualization technology offers many benefits, including higher utilization of the CPU and other hardware resources, easy software deployments, and simplified systems management. To make software management and deployment even easier, Oracle introduced Oracle VM Templates: prebuilt, preconfigured virtual machines (VMs) that are fully ready for deployment to a virtualized environment. A typical template includes a guest operating system and application software, along with configuration information needed for the VM deployment.

The main attraction for using Oracle VM Templates is to make deploying and managing VMs easier. Oracle offers a large number of VM templates for most popular Oracle products, including Oracle Database, Oracle Business Intelligence Enterprise Edition, Oracle WebLogic Server, Oracle Linux, and MySQL Database, to name a few.

Preparing Your Working Environment

Before you can make use of a template, you must first install Oracle VM, which requires installing at least one Oracle VM Server plus Oracle VM Manager.

To install Oracle VM Server, you'll need a clean machine. Oracle VM Server provides a hypervisor and a privileged domain (Dom0) to install directly on a bare metal server that does not require a host operating system.

Oracle VM Server takes over the entire hard drive, thus requiring a dedicated machine. If you just want to play a little with it and cannot provide a dedicated machine for it, a simple workaround might be to temporarily use another hard drive, such as a removable hard drive. There are motherboards that let you connect such external devices through the back panel of the computer as a SATA device. If that is not possible, you should be able to connect it through a USB port. Then, be sure to set it as the first boot device in the BIOS. To be on the safe side, you should temporarily unplug your regular hard drive. This approach allows you to easily revert back to your regular configuration later on.

After installing Oracle VM Server, you need to install Oracle VM Manager, which will be used to manage the virtualization environment created during the server installation. Oracle VM Manager does not require a dedicated machine. However, Oracle recommends that Oracle VM Server and Oracle VM Manager be installed on separate machines (installing both on the same machine is tricky and unsupported). In other words, you'll need another machine. As of Oracle VM Manager 3.0, you can install Oracle VM Manager on a computer running Oracle Linux 5 Update 5 (64-bit) or later.

To learn about the software and hardware requirements for a specific release of Oracle VM, refer to the appropriate Oracle VM installation guide.

During the simple installation of Oracle VM Manager 3.0, the following software components are installed:

  • Oracle Database, Express Edition 11g
  • Java
  • Oracle Application Development Framework
  • Oracle WebLogic Server
  • Oracle VM Manager, which is, in fact, an Oracle WebLogic Server application

Note: Oracle Database, Express Edition 11g is bundled with Oracle VM Manager 3 for customer-evaluation purposes, but Oracle Database, Standard Edition or Oracle Database, Enterprise Edition is required for production support as the management repository. All necessary licenses, including licenses for Oracle WebLogic Server and Oracle Database (Standard Edition or Enterprise Edition) are included at no additional charge. For more details, refer to My Oracle Support Doc ID 1356588.1: Oracle VM 3.0 WebLogic and Oracle Database Product Licensing and Support Policy (requires login).

Setting Up Your Oracle VM Environment

After you have installed Oracle VM Server and Oracle VM Manager, the next task is to see whether the machine hosting Oracle VM Server is pingable from the Oracle VM Manager's host. If it is, you can proceed to set up your Oracle VM environment with the help of Oracle VM Manager.

To start working with Oracle VM Manager, point your browser to this address: http://example.com:7001/ovm/console.

Alternatively, you can use Secure Sockets Layer (SSL) by pointing your browser here: https://example.com:7002/ovm/console.

You'll be routed to the Login page of Oracle VM Manager, where you need to enter the administration username and password you specified during the Oracle VM Manager installation.

Discovering the Oracle VM Server

To complete the task of discovering your Oracle VM Server, perform the following steps:

  1. In Oracle VM Manager, move on to the Hardware view.
  2. Select Discover from the Actions menu.
  3. In the Discover Servers dialog box, specify the IP address of your Oracle VM Server's host and the VM agent's password you provided during the server installation.

    Figure 1 shows what the Hardware view of Oracle VM Manager might look like after your Oracle VM Server has been discovered:

    Figure 1. The Hardware View of Oracle VM Manager

Creating a Server Pool

Now that your Oracle VM Server has been discovered, you can create a server pool, which is a required step when setting up an Oracle VM environment. To do this, follow these steps:

  1. Move to the Home view.
  2. Select Create Server Pool from the Actions menu.
  3. In the Create Server Pool dialog box, the only required fields are Server Pool Name and Virtual IP, as long as you have deselected the Activate Cluster checkbox. Otherwise, you also need to specify the Location of the server pool file system required for cluster data and for cluster heartbeating.

Adding the Discovered Server to the Server Pool

You can now add your Oracle VM Server to the newly created server pool by performing the following steps:

  1. Under the Home->Server Pools node in the navigator, select the newly created server pool.
  2. Select Add/Remove Servers from the Actions menu.
  3. In the Add/Remove Servers dialog box, move your Oracle VM Server from the Available Servers pane to Selected Servers.

Creating a Storage Repository for Storing Oracle VM Resources

The next required step is to create a storage repository for storing your Oracle VM resources, including Oracle VM Templates. Here, you have several options. In the simplest case, you can take advantage of an NFS share. The other options include local storage, iSCSI SAN, and Fibre Channel SAN.

Although it's more reliable to use a separate location (such as an NFS share) for a storage repository, you can use a local disk of your Oracle VM Server instead, thus taking advantage of the local storage option. Beware, though: Oracle VM Server 3.0 doesn't allow you to utilize the unused space on the physical disk it's installed on. For local storage, you'll need at least one more physical disk. In other words, you'll need a total of two disks at minimum on your Oracle VM Server host if you want to use local storage. In practice, though, local storage is not a primary use case. The major downside to this approach is that local storage, by definition, cannot be shared between different servers.

For the NFS share option, an NFS file server can be set up easily on the majority of operating systems being used today. The ability to expose a file system to a network so that remote hosts can mount it as if it is mounted locally provides interesting storage opportunities. For example, you might readily turn a host running Microsoft Windows into a file server that will host a storage repository in your Oracle VM environment. For further details on setting up an NFS server, you can check the vendor documentation.

Registering a File Server or a Storage Array

The next step is to register a file server or a storage array, depending on what you're going to use. As mentioned, this step is not required if you are using the local storage on your Oracle VM Server. In the case of the NFS share option, you'll need to register a file server. The following steps describe how you might do this, assuming you already have an NFS file server running in your network:

  1. 1. Move to the Hardware view.
  2. 2. In the navigator, click the Storage tab.
  3. 3. On the Storage tab, right-click File Servers and then select Register File Server.
  4. 4. On the first screen of the Register File Server wizard, fill out the Name and Access Host fields and select the storage plug-in in the Storage Plug-in list box.
  5. 5. On the next screen of the wizard, you should see your file server in the Available Servers pane. Move it to the Selected Servers pane, and complete the wizard.

    After completing the file server registration, Oracle VM Manager automatically starts a discovery job for the server's file systems. So, you should have a file system that can be used to create a storage repository for your server pool. That file system should appear under the File Servers->your_file_server node on the Storage tab of the Hardware view.

  6. 6. Next, create a storage repository based on the server's file system:
    1. Refresh the discovered file system by right-clicking it in the navigator and then selecting Refresh File System from the pop-up menu.
    2. Move to the Home view.
    3. In the navigator, select the Server Pools node.
    4. In the management pane, move to the Repositories tab.
    5. On the tools panel of the Repositories tab, click the Create icon.
    6. In the Create Repository dialog box, complete the required fields, which are Name, Repository Location, and, if you selected Network File Server for Repository Location, Network File System.

Presenting the Repository to the Oracle VM Server

As a result of the previous steps, the newly created repository should appear in the table on the Repositories tab. Now you need to present the repository to your Oracle VM Server so the server can use it. To do this, follow these steps:

  1. In the Repositories table on Repositories tab, select the newly created repository.
  2. On the tools panel of the Repositories tab, click the Present/Unpresent Selected Repository icon.
  3. In the Present this Repository to Server(s) dialog box, move your Oracle VM Server from the Servers pane to the Presented to Server(s) pane.
  4. On the tools panel of the Repositories tab, click the Refresh Selected Repository Contents icon to refresh the repository.

Obtaining an Oracle VM Template

After successfully completing the previous steps, you're ready to start working with Oracle VM Templates. The first step will be to obtain a template from the Oracle Software Delivery Cloud (requires login).

  1. For our example, go to the Oracle Linux and Oracle VM page of the Oracle Software Delivery Cloud.
  2. Sign in and accept the agreement on the Terms & Restrictions screen.

    You'll be directed to the Media Pack Search screen.

  3. Select Oracle VM Templates from the Select a Product Pack list.
  4. Select the platform from the Platform list.

    If you're using Oracle VM Manager 3.0 or later, you must select x86 64 bit.

  5. After selecting a product pack and platform, click the Go button to start searching for a template.

    Figure 2 shows what the Search page might look like after you've conducted a search for Oracle VM Templates on the x86 64-bit platform.

    Figure 2. Results of the Search

  6. Look through the list of the available templates, and select the one you are interested in.

    As a result, you'll be taken to the chosen template's download page, on which you might find more than one template download link. For example, at the time of this writing, the Oracle VM Templates for Oracle Database Media Pack for x86_64(64 bit) page offers two templates: one for Oracle Database 10g Release 2 and the other for Oracle Database 11g Release 1.

Also, on the download page, you can find the readme file accompanying the template. Read it carefully to learn the following:

  • What software components the template contains
  • Default configuration
  • Parameters of the included disk images
  • Deployment information

Importing an Oracle VM Template

After downloading the template archive to your system, move it to a directory where it will be available through FTP, HTTP, or HTTPS. (The template importing mechanism used in Oracle VM Manager is limited to those protocols only.)

The following steps describe how you can import a template into your Oracle VM environment through Oracle VM Manager:

  1. In Oracle VM Manager, move to the Home view.
  2. In the navigator, select the Server Pools node.
  3. In the management pane, move to the Templates tab.
  4. On the tools panel of the Templates tab, click the Import Template icon.
  5. In the Import Template dialog box, specify the repository (created as described in the preceding section) in the Repository field, specify the Oracle VM Server in the Server field, and specify the URL of the template archive in the Template URLs field, using either FTP, HTTP, or HTTPS.

If the importing process fails at the very beginning, the first thing to check is the firewall. In particular, you might need to disable the firewall on the host running Oracle VM Manager (the firewall is disabled on Oracle VM Server by default).

During importing, the template archive will be downloaded and then unpacked in the specified repository. Then the repository will be automatically refreshed so that Oracle VM Manager can reflect the changes made in its content tabs. Figure 3 illustrates what the Oracle VM Manager window might look like after the importing process has been completed successfully.

Figure 3. Templates Tab After an Importing a Template into the Oracle VM Environment

To view the template's configuration and network and storage information, select the template in the Templates table and then click an appropriate tab.

Creating a Virtual Machine from an Oracle VM Template

After you have successfully imported a template into your Oracle VM environment, you might want to create a virtual machine from it. Before you can do that, though, you need to perform some networking tasks in Oracle VM Manager. In particular, you need to create a virtual machine network and generate a set of Virtual Network Interface Cards (VNICs) that will be assigned to virtual machines as network cards.

To create a virtual machine network, follow the steps below:

  1. 1. In Oracle VM Manager, move to the Hardware view.
  2. 2. In the navigator, click the Hardware tab and select the Resources folder.
  3. 3. In the management pane, select the Network tab.
  4. 4. On the tools panel of the Network tab, click the Create New Network icon to invoke the Network Configuration wizard.
  5. 5. On the first screen of the wizard, select a network configuration option.

    If you have a single Oracle VM Server, you can select the Create a logical network on a single server option. In that case, the wizard will present only two more screens.

  6. 6. On the Create Network screen, specify a name for the network being created and, optionally, provide a description.
  7. 7. On the Select Server screen, make sure that your Oracle VM Server is specified in the Server field, and then complete any remaining steps in the wizard.
  8. 8. The next step is to generate a set of VNICs (at least one, if you're planning to create a single virtual machine):
    1. In Oracle VM Manager, select Vnic Manager from the Tools menu.
    2. In the Virtual Network Interface Card Manager dialog box, click Next to obtain the next available MAC address, and then click Generate.
  9. 9. Now you can create a virtual machine. To do this, you'll need to clone the template as follows:
    1. Move to the Home view.
    2. In the navigator, select the Server Pools folder.
    3. In the management pane, click the Templates tab.
    4. In the Templates table, select the template you want to clone.
    5. On the tools panel of the Templates tab, click the Clone icon.
    6. In the Clone Virtual Machine Template dialog box (shown in Figure 4), choose Simple Clone for the clone type, and select Virtual Machine for the target clone type. Also, enter a name for the virtual machine being created.

      Figure 4. Clone Virtual Machine Template Dialog Box

      As a result of the above steps, a virtual machine will be created and deployed to the server pool in a stopped state.

  10. 10. To run the VM, follow these steps:
    1. Move to the Home view.
    2. In the navigator, expand the Server Pools->your_server_pool->your_vm_server node.
    3. Right-click the virtual machine and select Start from the pop-up menu.
  11. 11. Now that the virtual machine is running, you need to install Virtual Machine Console, a tool available in Oracle VM Manager, so that you can you access the VM. Before you can take advantage of the Virtual Machine Console, you need to install a VNC viewer on the computer hosting Oracle VM Manager. This viewer can be, for example, TightVNC, whose latest package can be obtained from http://oss.oracle.com/oraclevm/manager/RPMS/
  12. 12. Next, download Java and install it on the computer from which you're connecting to Oracle VM Manager.
  13. 13. Now you can launch the Virtual Machine Console as follows:
    1. In the navigation pane of the Home view, expand the Server Pools->your_server_pool->your_vm_server node.
    2. Right-click the virtual machine icon and select Launch Console from the pop-up menu.
    3. When prompted, enter the login credentials for Oracle VM Manager.

    As a result, the virtual machine's console should appear, reflecting the virtual machine's load process. On the first load, you'll be asked several questions to configure the virtual machine. In particular, you'll be asked whether you're going to obtain an IP address for the virtual machine via DHCP or use a static IP address.

    • If you choose to use a static IP address, you'll be prompted to enter some more details, such as an IP address, netmask, and gateway.
    • If you want to use DHCP, you need a working DHCP server in your Oracle VM environment.

    Figure 5 illustrates what the console might look like at this stage:

    Figure 5. Virtual Machine Console During the First Start of a Virtual Machine

The preinstalled applications might also require some configuration during the first load of a virtual machine. For example, when first loading a virtual machine with a preinstalled Oracle Database, you'll be prompted to enter the TCP/IP port for the Oracle Net listener as well as the password for system accounts and other things that are needed to set the initial configuration parameters of the database. You will also be asked whether you want the database to be started on boot.

After this initial configuration, you'll be prompted to log in to the guest operating system. You can login as root using the password ovsroot (which is the case for all Oracle VM templates). If a template contains an Oracle database, as in our example, you can use the database account oracle with the password oracle to connect to the database.

Creating a New Template from a Virtual Machine

As you probably realize, the cloning mechanism we touched on in the preceding section is not limited only to creating a virtual machine from a template. In fact, cloning also allows you to create new templates from existing ones and even create new templates and virtual machines from existing virtual machines.

Turning back to our example, let's clone the virtual machine created from a template in the preceding section to create a new template. The reasoning here is to create a template that might be used to generate virtual machines that do not require initial configuration, which could shorten the time it takes to get those virtual machines ready for use. With this approach, some parameters might be configured later, if needed, of course.

The following steps describe how you might create a new template from a virtual machine:

  1. In the navigation pane of the Home view, expand the Server Pools->your_server_pool->your_vm_server node.
  2. If the virtual machine is running, right-click its icon and select Stop from the pop-up menu. Otherwise, skip to the next step.
  3. Right-click the virtual machine icon and select Clone from the pop-up menu.
  4. In the Clone Virtual Machine Template dialog box, choose Simple Clone for the clone type field and select Template for the target clone type. Then, enter a name for the template being created.

In the preceding steps, you performed a clone operation known as a cold clone, because a clone was created from a stopped virtual machine. Alternatively, you might perform a hot clone by dealing with a running virtual machine. Be warned, though: A hot clone produces a clone with inconsistent disk status, which makes it suitable only for use as a snapshot or a backup copy.

After completing the preceding steps, you should have a new template you can use to create virtual machines that do not require initial configuration. However, there are at least two parameters you most likely will want to change when a new virtual machine is created from this template:

  • The host name
  • The IP address, in case you chose to use a static IP address

It seems reasonable to do that, unless you want to have more than virtual machine sharing the same host name and IP address in your network.

If you want to change these parameters at the first start of the virtual machine, perform the following steps:

  1. 1. Through the virtual machine's console, log in to the guest as root (using the password ovsroot).
  2. 2. Use the vi text editor to edit the following configuration files, changing the IP address and the host name to the new values:
    • /etc/sysconfig/network
    • /etc/hosts
    • /etc/sysconfig/network-scripts/ifcfg-eth0
  3. 3. Stop the virtual machine and then start it again for the changes to take effect.

As you might guess, the example discussed here is rather unlikely. It's hard to believe that someone would choose to do manual configuration in place of answering some questions on the first boot of a virtual machine. However, there might be situations where you have a need to create a template from a virtual machine. For example, after creating some objects (such as tables, views, indexes, and stored procedures) in a virtual machine that is running an Oracle database, you might want to create a template from that virtual machine.

Reconfiguring a Template

So far, we have looked at a simple clone created with the same configuration as the item from which it was cloned. In practice, though, you might need to create a clone with different configuration and deployment options. This is where you can take advantage of the advanced clone option.

To perform an advanced cloning of a template, you invoke the clone operation for that template and then select Advanced Clone for the clone type. Then, the wizard will walk you through the process of reconfiguring the template.

Moreover, you can edit a template, changing its network settings, amount of memory, virtual CPU number, and so on.

To invoke the Edit Template wizard, follow these steps:

  1. Move to the Home view.
  2. In the navigation pane, select the Server Pools folder.
  3. In the management pane, click the Templates tab.
  4. In the Templates table, select the template you want to edit.
  5. On the tools panel of the Templates tab, click the Edit Template icon.

    The first screen of the Edit Template wizard is shown in Figure 6.

    Figure 6. First Screen of the Edit Template Wizard

When you complete the steps in the wizard, you should have a template with the configuration differing from the initial configuration.

Conclusion

As you learned in this article, Oracle VM Templates provide a good way to distribute Oracle technologies to an Oracle VM environment, making it easy for you to get up and running quickly.

This article described a simple example of the Oracle VM Templates technology in action. The template containing Oracle Database running on Oracle Linux was downloaded and then imported into an Oracle VM environment. Then, the article described how you might clone the template to create a new virtual machine or a new template with different configuration.

See Also

For more information, see the Oracle VM Templates Website: http://www.oracle.com/virtualization/technologies/virtual-appliances.html.

About the Author

Yuli Vasiliev is a software developer, freelance author, and consultant currently specializing in open source development, Java technologies, business intelligence, databases, service-oriented architecture (SOA), and, more recently, virtualization. He is the author of a series of books on Oracle technology; the most recent one is Oracle Business Intelligence: An Introduction to Business Analysis and Reporting (Packt, 2010).