Using Custom Boot and Login Scripts for a Virtual Appliance
InstallAnywhere 2021
Virtual appliances built by InstallAnywhere have the capability of automatically calling scripts at specific lifecycle stage: first boot, first login, subsequent boot, and subsequent login of the virtual appliance.
For example, if you have installed an Apache Web server in your virtual appliance, and this needs to be started every time your appliance boots up, you need to write a small shell script that starts your Apache web server each time that it boots up.
Note:InstallAnywhere appliances also run some internal scripts at each of these lifecycle stages. These internal scripts help safeguard the security of your appliances by regenerating the different SSL keystores and helping the end user set up a default password for the virtual appliance during deployment.
Because user interaction is not supported during boot time, custom boot scripts (first boot and subsequent boot) should not have any sections that have user interaction. Also, the display of output user messages from the first/subsequent boot are not visible on the console during boot time.
Custom boot scripts (first boot and subsequent boot) support only shell script.
To specify the custom scripts that you want to use:
|
1.
|
In the Advanced Designer, on the Build page, click Build Appliances. The Build Appliances view opens. |
|
2.
|
Click the Appliance Configuration tab. |
|
3.
|
In the Select Appliance Configuration list, select the appliance configuration that you want to customize. |
|
4.
|
Click the VM Configuration tab. |
|
5.
|
For VMware vSphere appliances: In the Select VM Tier list, select the VM tier that you want to configure. |
|
6.
|
Click the Script Info subtab. |
|
7.
|
Select the Choose button next to any of the following settings and select the script file that you want to use: |
|
•
|
First Boot Script—Select a script that runs the first time that the virtual appliance is launched. |
|
•
|
First Login Script—Select a script that runs the first time that an end user logs into this virtual appliance. |
|
•
|
Subsequent Boot Script—Select a script that runs each time that the virtual appliance is launched. |
|
•
|
Subsequent Login Script—Select a script that run each time that an end user logs into this virtual appliance. |
About First-Boot Scripts
When a virtual machine in the appliance starts up, it might be necessary to perform some customization based on user input. Using a first-boot script enables you to receive this input from the end user of the appliance. Examples of the sort of input that may be needed are the root password and port numbers of applications.
InstallAnywhere uses two first-boot scripts:
|
•
|
InstallAnywhere-reserved first-boot script—InstallAnywhere includes this script; it always includes the VM execute command. It also performs the following tasks: |
|
•
|
Prints a welcome message for the end user |
|
•
|
Displays the EULA and obtains the acceptance |
|
•
|
Changes the OS language |
|
•
|
Changes the keyboard layout |
|
•
|
Sets up the OS for unattended upgrades |
|
•
|
Regenerates the SSL keystores |
|
•
|
Installs first boot InstallAnywhere installers |
|
•
|
First-boot script that is specified in the InstallAnywhere project—This script contains customizations that might be needed for specific application files based on user interactions. |
For VMware vSphere appliances, InstallAnywhere declares many of the properties for which the user input is usually needed as OVF properties. The VMware software that deploys the OVF prompts for these OVF properties. The values are made available to the scripts using OVF environment variables (just like pre-populated environment variables). So in case of VMware, InstallAnywhere uses a single, unified shell script that contains the following parts:
|
•
|
A shell script constants section that aliases these OVF environment variables to the shell script using variables. |
|
•
|
The reserved first-boot script. |
|
•
|
The user-defined first-boot script. |
For Amazon EC2 appliances, the OVF properties are not present, so InstallAnywhere prompt you for input and includes these customizations in the first-boot scripts.
InstallAnywhere creates a file named appliance.info for every VM in the virtual appliance. You can find this file in the /etc/ia/ subdirectory of the output directory. This file contains following information, which you may want to add to your first-boot scripts:
ApplianceVersion=version_of_appliance
ApplianceUUID=uuid_of_appliance
ApplianceVendor=vendor_of_appliance
ApplianceEULALocation=location_of_the_EULA
VirtualmachineName=name_of_the_virtual_machine
VirtualmachineVersion=version_of_the_virtual_machine
VirtualmachineUUID=uuid_of_the_virtual_machine
See Also
Script Info Subtab