You are on page 1of 8

W H I T E PA P E R

Best Practices for Building Multi-Platform Installers
by Robert Dickau Principal Technical Training Writer, Flexera Software

Best Practices for Building Multi-Platform Installers
Introduction
A well-planned installation and deployment strategy should be part of any serious software development project. When the installer is an afterthought, the result is usually a poorly prepared first impression for end users. In practice, however, this critical requirement is sometimes ignored until the software is complete. Why wait until the product is ready to be released before thinking about deployment? This white paper will assist developers of multi-platform applications create professional, reliable installations that make a favorable first impression for your products. It covers the fundamentals of installation planning and shows you how to use InstallAnywhere from Flexera Software to manage the different aspects of your installation projects according to proven best practices. Today’s sophisticated software applications require complex configurations, and complex configurations require installation utilities. You can choose from a variety of methods and types of installation utilities. Windows and Macintosh users are familiar with the executable installer (for example, InstallAnywhere from Flexera Software), while users of Unix systems are accustomed to deployment schemes that utilize complex scripts or native package managers. Installation utilities allow you to provide your end users with a familiar interface, assuring a positive product installation experience with a minimum of inconvenience. Many ready-made solutions are available for specific target platforms. For example, RPM is a packaging system that generally functions only on Linux (though it has been introduced to other mainstream Unix and Unix-like distributions). Such targeted solutions are not useful for multi-platform deployment. Multi-platform deployment—while once unusual—is no longer a fringe issue. More platform-agnostic software development is being done in languages such as Java, Perl, Python, PHP, and those outlined by the .NET standards. In order to keep pace with this new development landscape, you need a tool that deploys and configures your applications on many different platforms.

The Need for a Professional Installation Utility

Regardless of whether your end user is a member of the general public, a consulting client, or another group within your own organization, it is unlikely that the product will simply be checked out of a source control solution and the resources laid immediately into their final operational location. Once you have made your Gold Master, how does the software make its way to your customers? Will it be enough to simply deliver an archive such as a .zip or .jar file, or a Unix tarball? This method allows you to deliver a number of different file-types as a single unit. This is one deployment option, and it is easier than having your end user login to a source control solution, or copy individual files. However, this method has inherent weaknesses. Rarely can a collection of files be simply laid into a file system, and be ready for one-click execution without some measure of configuration. What if the application requires installation into several locations? What if portions of the installation require configuration prior to use?
2

Learn More about InstallAnywhere If you wish to learn more about the capabilities of InstallAnywhere, please visit the Flexera Software Web site at www.flexerasoftware.com/ installanywhere.

Flexera Software: InstallAnywhere White Paper Series

Best Pract ices for Building Mult i-Plat form Installers

Installation Planning

Occasionally, you will find that planning an installation is simple. Put the files to disk in their specified location, and the application will just work. However, this situation is usually not the case. In today’s world of systems integration, installation stacks, suite installers, and client-server application development, you are far more likely to run into a very complex installation scenario-one requiring multiple steps, multiple products, and intricate configuration steps. The idea behind using a fully featured installer such as InstallAnywhere is to minimize the impact that this sort of complexity will have on your customers and your end users. As such, it is important to carefully plan your installation process and installation needs prior to beginning development.

The following table provides Advanced Designer task descriptions. Name Project Description Settings related to your specific project. These include general settings, file settings, and localization settings. Set the look and feel for the installer by adding background images, billboards, and other graphical elements. Manage Install Sets, Features, Components, and Merge Modules. An ordered sequence of panels and actions that occur before file installation. Manage the file installation tree and installation-time actions. An ordered sequence of panels and actions that occur after file installation. An ordered sequence of panels and actions that occur before file uninstallation. An ordered sequence of panels and actions that occur after file uninstallation. Manage build settings, including bundling of a Java Virtual Machine.

Installer UI

Organization Pre-Install Install Post-Install Pre-Uninstall Post-Uninstall Build

Installation Goals

When planning your installation process, consider the goals and targets of your installation. • Is it required to allow a non-technical end user to install a complex product or as a highly flexible installer that can be used in a number of environments by expert users? • What platforms and architectures will your deployment project target?

Working with Advanced Designer

The InstallAnywhere Advanced Designer has an intuitive, graphical interface which allows developers to manage all aspects of their installer project. All the features of InstallAnywhere are available in this easy to use integrated development environment. To access the InstallAnywhere Advanced Designer, click the Advanced Designer button after selecting a project file or creating a new project. The Advanced Designer is divided into “Tasks”, which are represented by tabs found along the left side of the window. Each tab represents tasks and settings specific to each installation project.

Each Advanced Designer task contains sub-tabs that offer greater fine-tuning of InstallAnywhere’s features. For an example, refer to the Advanced Designer tutorial.

Defining Installer Projects and the Product Registry

Product Registry The product registry is essentially a product configuration database which keeps track of features and components of products for the operating system. It is the product registry which accomplishes tasks such as associating file name extensions with applications. InstallAnywhere makes entering vendor and product information to uniquely identify their product in the product registry information easy. Note: Correctly setting the Product ID and Version are critical to using the Find Component in Registry action. It is by checking the Product ID that InstallAnywhere finds the locations of components in the Registry. Product ID and vendor information is entered in the Project > Description subtask.

Flexera Software: InstallAnywhere White Paper Series

3

Best Pract ices for Building Mult i-Plat form Installers

Installer Identification and Version

Installers—just like the software products they are installing—need to be given names and versions. Just as names and versions help track changes in a software product, InstallAnywhere helps uniquely identify versions of installers. InstallAnywhere also provides an installation log which details the files installed and the actions execute by the installer. You can control the creation of an installation log, the format of the log, whether it should be created in plain text or XML format, and whether the installation log should be removed if the application is uninstalled. Note: To set the Installation log install location, set the InstallAnywhere Variable $INSTALL_LOG_DESTINATION$. The Project > Info task defines basic information about the installer that is to be created, displays information about the InstallAnywhere installer project, and enables the developer to make decisions about the installer installation log.

Installed File Timestamps

The File Modification Timestamp Behavior section enables developers to timestamp installed files in three different ways. • Preserve Timestamp—This selection maintains the default timestamp on the file. That is, the time that file was last modified as shown by the operating system where the file was created or saved. For example, the file would show the time it was last modified and not when it was installed. • Install Time Timestamp—This selection sets the creation property and the file modification property to the time that the files are installed on the target system. With this option all the installed files would have the same creation and file modification properties. • Specify Timestamp—This selection enables developers to place a specific timestamp on installed files. Specific date and time stamps may be selected from the scroll lists. Note: The file’s timestamp property may be set to both before and after the current date. InstallAnywhere displays all timestamps in the system’s local time zone. Internally, InstallAnywhere automatically maintains those timestamps in Greenwich Mean Time (GMT), but the timestamps display in the local time zone.

File Settings: Timestamps and Overwrite Behavior

When installing software, whether a new product or a newer version of a product, there is the possibility of overwriting files that already exist on the target system. InstallAnywhere uses timestamps to uniquely identify files with the same name. InstallAnywhere also allows the developer to set the type of overwrite behavior—whether to prompt the end user, whether to overwrite the older file. Note: When installing to Windows operating systems, there may be files that are in use. When the “Replace in-use files after restart” option is selected, the installer action will detect if files that are being installed are overwriting files that are in use. If there are files in use, InstallAnywhere will register these files with the Windows Product Registry, so they can be correctly installed when the system is restarted. Timestamps, in-use file behavior, and overwrite behavior are defined in the File Settings subtask.

Default Overwrite Behavior

When the installation contains files that also exist in the installation locations on the target system, the installer must know how to determine whether to overwrite files. Files are considered the same when they have the same name and have the same path. Whether to overwrite or not install the files is dependent on the timestamps of the files on the target computer and the timestamp of installation files. Note: For Windows systems, InstallAnywhere also includes an overwrite-after-restart option for files that are in use during installation. To enable this option, click “Replace in-use files after restart.”

4

Flexera Software: InstallAnywhere White Paper Series

Best Pract ices for Building Mult i-Plat form Installers

The default behavior is to overwrite older files and prompt if newer. The options for determining overwrite behavior may be prompted or set as a default. Overwrite Option Always overwrite Never overwrite Select this option to: Install files without giving the user the choice whether to overwrite files which currently exist on the computer. Leave existing files untouched on the user’s computer rather than overwrite them with files that are being installed. The user is given no option. Overwrite existing files on the user’s computer that are the same as files that are being installed if the installed files are newer (have a later timestamp) than the existing files. The user is given no option. Overwrite existing files on the user’s computer that are the same as files that are being installed if the installed files are newer (have a later timestamp) than the existing files without giving the user the option, but prompting if the installed files are older than the existing files on the user’s computer.

Platforms

While InstallAnywhere runs on any Java-enabled platform, there are features such as default install folders and default link folders (Unix), default shortcut folders (Windows), and default alias folders (Mac OS X) that should be defined separately for each target operating system. The Platforms task is separated into different platforms. For Windows, you specify the default install and shortcut folders, and choose between using a graphical launcher or a console launcher.

Overwrite if older, do not install if newer

Overwrite if older, prompt if newer

To support User Account Control (UAC) on Windows Vista target systems, you can also specify the execution level: • As Invoker: The launcher acquires the same execution level as its parent process. • Highest Available: The launcher requests the highest execution level (Windows privileges and user rights) available to the current user. • Administrator: The launcher requires local admin privileges to run. Depending on the privileges of the current user account and the configuration of the target system, this setting may result in a launcher that will not start. Starting with InstallAnywhere 2009, you can use the Windows JVM Search Paths settings (not pictured) in this task to control how the InstallAnywhere run-time locates compatible Java virtual machines. Mac OS X adds defining default permissions for files and folders that will be created on the target system. The developer can also enable installer authentication (providing the end user correct permissions to install if they are not running as a privileged user) and the ability to set which VM versions.

Prompt if older, Prompt the user if the existing files on do not install if the user’s computer are older than the newer installation files. If the existing files are newer, there will not be a prompt and the installation files will not be installed. Always prompt Prompt the user whenever an installation user file exists on the target computer.

If the file-overwrite options are set to prompt the user, a sample prompt appears similar to the following figure.

Flexera Software: InstallAnywhere White Paper Series

5

Best Pract ices for Building Mult i-Plat form Installers

The Unix task shows similar settings. For Linux target systems, you can enable RPM (Red Hat Package Management) support. RPM is a package of installation tools that InstallAnywhere installers will use in the Linux environment and other Unix environments. The RPM feature enables the installer to interact with and make entries into the RPM database. Beginning with InstallAnywhere 2008 Value Pack 1, you can additionally specify to integrate with the AIX Software Vital Product Database (SWVPD).

InstallAnywhere uses variable-based Boolean rules to control most aspects of installer behavior. The Rules logic allows developers to create simple and complex logic systems that determine which actions will occur. The rules can be structured based on end-user input, or on conditions determined by the installer. Some rules should be evaluated before any installation tasks, even Pre-Install tasks, occur. These rules, such as checking if the target system is a proper platform for this installation, if the user is logged into the root, or has the necessary permissions to perform the installation, can be added in the Project >Rules subtask.

Creating Debug Output

Installer debug output information can be useful for tracking down issues in an installer. InstallAnywhere developers can enable debug output as well as select if it should be sent to a file or to a live console. Installer Debug Output If the “Send stderr to” or the “Send stdout to” field is left blank, the corresponding output of the installer will be discarded. To send the output to a live console to monitor the output, enter console in the text field. To send the information to a file, enter the file name. Starting with InstallAnywhere 2009 you can include environment variables and Java system properties in the redirection target instead of hard-coding file locations. InstallAnywhere 2008 introduced classes that enable automated testing of installers using JUnit tests. For information and examples, refer to the gui-test-auto subdirectory of your InstallAnywhere Distribution. Starting with InstallAnywhere 2009, you can use the Pure Java task to control the user-interface mode a pure Java installer and uninstaller should use.

Starting with InstallAnywhere 2009, you can use the Unix JVM Search Paths settings (not pictured) to control InstallAnywhere’s detection of Java virtual machines. Beginning with InstallAnywhere 2008 Value Pack 1, you can also specify to integrate with the Registered Application Information Repository (RAIR) on i5/OS systems.

Virtual Machines

InstallAnywhere enables you to define a valid list of JVMs (Java virtual machines) your installer can use. This option can be used to select VMs that have been fully tested. LaunchAnywhere searches for VMs sequentially based on VM type. Valid VM types are listed in the LaunchAnywhere Executable property lax.nl.valid.vm.list. LaunchAnywhere uses the following default approaches on each platform: • Windows: first search on the system path, then the system registry. • Unix: search the system path. • Mac OS X: LaunchAnywhere will use the VM specified in the Project > Platforms > Mac OS X task. Starting with InstallAnywhere 2009, you can use settings in the Platforms task to override the default JVM search behavior for the installation on different platforms. With InstallAnywhere, you can also set the heap size for the VMs.

Locales

The Locales subtask defines the languages for which the installer will be created. A locale is enabled when it is checked. Each enabled locale will generate a locale file that will be placed in a folder that is in the same directory as the InstallAnywhere project file. To customize a locale, customize this file.

Rules Before the Pre-Install Task

InstallAnywhere Rules can be applied to any action within the InstallAnywhere installer, as well as to organizational units such as Install Sets, Features, and Components.
6

Flexera Software: InstallAnywhere White Paper Series

Best Pract ices for Building Mult i-Plat form Installers

Note: Change the heap size when experiencing out-of-memory conditions. With large installations that have many files to install, the heap size may need to be increased.

Summary

Optional Installer Arguments

To support Java VM configuration options which are not available through the InstallAnywhere Advanced Designer, specify additional command line parameters to pass to the Java VM used by the installer through the use of the Optional Installer Arguments > Additional Arguments field.

This white paper discussed the fundamentals of installation planning and highlighted how to use InstallAnywhere from Flexera Software to manage the different aspects of your multi-platform installation projects according to proven best practices.

Java

Begin a Free Evaluation of InstallAnywhere

The Project > Java subtask enables you to fine tune the classpath settings and decide whether to install the bundled Java VM. You may choose not to install a VM, install the VM only while performing the installation, or to leave the VM on the target system. If you choose to install the VM, the VM Install folder drop-down list provides a variety of locations. Available in the Java subtask (starting with InstallAnywhere 8.0) is the Add Service Support for Custom Code checkbox. InstallAnywhere provides a service layer that adds a rich suite of APIs for use in custom code actions. This check box must be selected if you use the FileService, SecurityService, SystemUtilService, Win32RegistryService, or Win32Service API calls in your custom code. If you use one of those calls with this check box unchecked, you will get a NoClassDefFound exception and the custom code will not execute properly.

You can download a free trial version of InstallAnywhere from the Flexera Software Web site at: www.flexerasoftware.com/installanywhere/eval.

Want to learn more best practices for building quality installations? Join an InstallAnywhere training class – visit www.flexerasoftware.com/services/education.htm for available classes. Also, if you have a critical installation project but are short on developer bandwidth or expertise, Flexera Software’s Professional Services team can help. Learn more at: http://www.flexerasoftware.com/services/consulting/softwareinstallations.htm.

Flexera Software: InstallAnywhere White Paper Series

7

Flexera Software LLC 1000 East Woodfield Road, Suite 400 Schaumburg, IL 60173 USA

Schaumburg (Global Headquarters): +1 800-809-5659

United Kingdom (Europe, Middle East Headquarters): +44 870-871-1111 +44 870-873-6300

Japan (Asia, Pacific Headquarters): +81 3-4360-8291

For more office locations visit: www.flexerasoftware.com

Copyright © 2011 Flexera Software LLC. All other brand and product names mentioned herein may be the trademarks and registered trademarks of their respective owners. IA_WP_MultiPlatform_Oct11