Save the system settings for a Linux guest operating system in a customization specification, which you can apply when cloning virtual machines or deploying virtual machines from templates.

Prerequisites

  • Verify that all requirements for customization are met. See Guest Operating System Customization Requirements.
  • To run the customization script:
    • Verify that VMware Tools version 10.1.0 or later is installed. The customization fails if VMware Tools is version earlier than 10.1.0 and you attempt to run the customization script.
    • In the VMware Tools configuration, the enable-custom-scripts option is deactivated by default for security reasons. When you attempt to run the customization script with a deactivated enable-custom-scripts option, the customization fails with a customization error.
      For example, to enable the enable-custom-scripts option, you must run vmware-toolbox-cmd as root user with the config command:
      vmware-toolbox-cmd config set deployPkg enable-custom-scripts true
      cat /etc/vmware-tools/tools.conf
      [deployPkg]
      enable-custom-scripts = true
      To verify that you set the option correctly, you can run the following command:
      vmware-toolbox-cmd config get deployPkg enable-custom-scripts
      [deployPkg] enable-custom-scripts = true

      For more information, see the VMware Tools User Guide.

Procedure

  1. Select Menu > Policies and Profiles, and under Policies and Profiles, click VM Customization Specifications.
  2. Click the Create a new specification icon.
    The New VM Guest Customization Specification wizard starts.
  3. On the Name and target OS page, enter a name and a description for the customization specification, select Linux as a target guest OS, and click Next.
  4. On the Computer name page, enter a computer name for the guest operating system and a domain name.
    The operating system uses the computer name to identify itself on the network. On Linux systems, it is called the host name.
    Option Action
    Use the virtual machine name Select this option to use the virtual machine name. The computer name that vCenter Server creates is identical to the name of the virtual machine on which the guest operating system is running. If the name exceeds 63 characters, it is truncated.
    Enter a name in the Clone/Deploy wizard Select this option to be prompted to enter a name during cloning or deployment.
    Enter a name
    1. Enter a name.

      The name can contain alphanumeric characters and a hyphen (-). It cannot contain a period (.), blank spaces, or special characters, and cannot contain digits only. Names are not case-sensitive.

    2. (Optional) To ensure that the name is unique, select the Append a numeric value check box.

      This action appends a hyphen followed by a numeric value to the virtual machine name. The name is truncated if it exceeds 63 characters when combined with the numeric value.

    Generate a name using the custom application configured with vCenter Server Optional: Enter a parameter that can be passed to the custom application.
  5. Enter the Domain Name for the computer and click Next.
  6. On the Time zone page, select the time zone for the virtual machine and click Next.
  7. On the Customization script page, apply a customization script to the guest operating system of the VM and click Next.
    1. To upload a file containing the customization script, click Browse and navigate to the file on your local machine. The contents of the script appear in the Script text box.
    2. (Optional) Enter the customization script directly into the Script text box.
    The customization script cannot exceed 1500 characters.
    Note:

    The default timeout period for the guest customization to complete is set to 100 seconds and includes the time for the script to run when you use a "precustomization" command-line parameter. If you run scripts that take a time exceeding the timeout, the guest customization fails.

    When you add a customization script with the "precustomization" command-line parameter, it is called before the guest customization begins. As a result, the virtual NIC is disconnected and you cannot access the network.

    When you add a customization script with the "postcustomization" command-line parameter, it is called after the guest customization finishes. As a result, the script is scheduled in the initialization process after the virtual machine powers on, the NIC is connected, and you can access the network. The time for the script to run is not included in the default timeout period and you avoid a guest customization failure.

    Customization Script Example
    #!/bin/sh
    if [ x$1 == x"precustomization" ]; then
    echo Do Precustomization tasks
    elif [ x$1 == x"postcustomization" ]; then
    echo Do Postcustomization tasks
    fi 
  8. On the Network page, select the type of network settings to apply to the guest operating system and click Next.
    • Select Use standard network settings so that vCenter Server configures all network interfaces from a DHCP server by using the default settings.
    • Select Manually select custom settings and manually configure each network interface.
      1. Select a network adapter from the list or add a new one.
      2. For the selected NIC, click Edit.

        The Edit Network dialog box opens.

      3. To configure the virtual machine to use an IPv4 network, click the IPv4 tab.

        If you select the Prompt the user for an IPv4 address when the specification is used option, vCenter Server prompts for an IP address when you select to apply the customization specification during cloning or deployment. You are also prompted to configure the gateways during cloning and deployment.

      4. To configure the virtual machine to use an IPv6 network, click the IPv6 tab.

        If you select the Prompt the user for an address when the specification is used option, vCenter Server prompts for an IP address when you select to apply the customization specification during cloning or deployment. You are also prompted to configure the gateways during cloning and deployment.

      5. Click OK.
  9. On the DNS settings page, enter DNS server and domain settings.
    The Primary DNS, Secondary DNS, and Tertiary DNS text boxes accept both IPv4 and IPv6 addresses.
  10. On the Ready to complete page, review the details and click Finish to save your changes.

Results

The customization specification that you created is listed in the Customization Specification Manager. You can use the specification to customize virtual machine guest operating systems.