9.5. Installation ToolsThe previous section described the various file formats that can be used to release a collection of files (i.e., a package). This section describes installation tools, which are the tools that create installers, which are the programs (and their datafiles) that actually run on the customers' machines. Installers not only unpack and decompress the files from whatever package file format was used; they also perform all the other steps necessary to make the product work on each machine. Table 9-1 shows some of the different ways to install software, along with examples.
In the same way that each different kind of machine requires a different set of actions to install software on it, so too do different installation tools exist for building installers for each platform. One installation tool builds Windows executables, while another builds rpm packages for a GNU/Linux distribution. The Java-based tool InstallAnywhere generates multiplatform installers from a single specification, but this tool seems to be used mostly for creating installers for products written in Java. 9.5.1. RequirementsWhen evaluating an installation tool, be careful to distinguish between what the installation tool should do and what the installers that it produces should be able to do. For instance, you may want to produce installers that have Japanese text, but do you also need the installation tool to be localized for Japanese? Just as some projects choose to write their own build tool, some projects create their own installation tools. This does have the advantage that the source code for the tool can be reviewed and tested as exhaustively as the rest of the product. However, this approach is a substantial amount of overhead for most projects, so carefully consider the existing tools first. 9.5.1.1. ToolsSome desirable characteristics of installation tools are:
9.5.1.2. InstallersSome characteristics to look for in installers and uninstallers, no matter which platform or packaging format is used, are:
Some smaller, but helpful ideas for graphical installers are:
9.5.2. UnixInstaller programs for Unix have become more common since the 1990s, with the rise of GNU/Linux and CPAN for Perl modules. The lack of standard locations for key files on a Unix machine means that you always have to be aware of how each machine is configured, and so installation using source code is more common in Unix than on Windows machines. I'd like to report that Unix configurations have become more standard and that there was an obvious installation manager to choose, but I can't. I recommend using the default installation tools that already exist on your machine and then trying others if and when they fail. Using packages from a single source may help your installations to succeed more often. 9.5.2.1. Source code and binariesThe source code to your product can be distributed using one of the packaged formats discussed in Section 9.4, earlier in this chapter. They're easy to create and, if the customer has the right tool, easy to unpack. The packaged files may contain ready-built binaries for each platform or, more commonly in the case of open source products, the actual source code itself. There are de facto standards for files to help customers complete the installation of the product after unpacking it. There are files such as README (start here first), LICENSE or COPYING (legal stuff), HACKING (how to change the source code), and the vital INSTALL file, which usually tells you how to actually use the product. Build tools such as GNU Autotools (see Section 5.5.3) provide help with creating such files. Another, much more formal standard is the Linux Standard Base (LSB; see http://www.linuxbase.org), which describes what to expect from a standard GNU/Linux machine. Installing products from their source files is probably the most portable way to install software onto a wide variety of Unix platforms. When the more convenient rpm or deb packages fail to work, or when you want to know why the product isn't supported on your platform, it's time to "use the source, Luke." 9.5.2.2. RPM package managerThe Red Hat distribution of GNU/Linux is responsible for creating the rpm format and its companion installation tool (also named rpm), which now ships with each copy of Red Hat Linux. Various products were repackaged in the rpm format for Red Hat, and web sites such as rpmfind (http://rpmfind.net) grew up to help find RPMs for each package. rpm maintains a database on the local machine to track every package that has been installed, and it's relatively easy to use. However, if an installation fails because other packages have to be installed first, rpm simply leaves you with the name of the missing packages, and it's back to rpmfind you gothere is no automatic downloading of other required packages. In an attempt to make the whole process of installing and upgrading packages a little easier, Red Hat created up2date, an application with both command-line and graphical interfaces, to download and install not only packages you specify, but also those required by your specified packages. However, up2date requires that you sign up on the Red Hat Network and register your machine and its current configuration. Other choices for rpm-based installation managers are Yum (http://linux.duke.edu/projects/yum), which is becoming the de facto standard for RedHat, and apt4rpm (http://apt4rpm.sourceforge.net), which is a version of apt for rpms by Conectiva, the Brazilian GNU/Linux distribution (now part of Mandrakesoft). Both of these installers can create their own package databases from the local rpm one, use signatures, and download any other necessary packages. One installation manager that claims to handle conflicts better than all others is the Python-based Smart Project Manager (http://smartpm.org), developed by Gustavo Niemeyer, who was part of the team that created apt4rpm.
9.5.2.3. aptDebian Linux's deb packaging format also has its companion installation tool named dpkg, but the installer tool that is more frequently used is apt (Advanced Packaging Tool), which has always supported downloading the dependent packages needed to make an install succeed. apt's other advantage over rpm is that it uses benchmark systems to determine which versions of software should work best on your system. One GUI for apt is synaptic, but there are a number of others available. apt has also been made to work with rpms in a few different ways. The tool apt4rpm (http://apt4rpm.sourceforge.net) is a version of apt for rpms. There is also alien (http://www.kitenet.net/programs/alien), which is a package converter that can convert between rpm, deb, and several other package formats, allowing you to use deb packages like rpm packages, and rpm packages like deb packages. 9.5.2.4. CPANCPAN (Comprehensive Perl Archive Network) is a good example of a successful installer, though only for products in one language: Perl. The command-line interface for using CPAN is straightforward, and there are plenty of graphical interfaces available too. The modules are downloaded as gzip'd tarballs of source code and built locally using make. Any other missing modules can also be automatically downloaded. CPAN uses a worldwide collection of mirror sites, all containing the same packages. The strengths of CPAN are that the range of modules is enormous and that it is a focal point for the Perl community. It has scaled well with a large number of users and is one reason for the popularity of Perl. The main weakness is that all of the modules are developed independently, so you may end up with long installation chains (see Section 9.6 later in this chapter) or with two different modules needing different versions of another module. 9.5.3. WindowsSome good resources for lists of mainly Windows-related installation tools are the Open Directory category at http://dmoz.org/Computers/Software/System_Management/Installers and InstallSite (http://www.installsite.org/pages/en/msi/authoring.htm), which is a web site dedicated to Windows installers and to InstallShield in particular. 9.5.3.1. Windows InstallerWindows Installer is the name of the installation toolset that has been released with all Windows releases since Windows ME. Now at Version 3.0, Windows Installer produces MSI files that can be executed to behave as an installer. The benefits of Windows Installer include atomic installs, add/remove program integration, checking for files in use, and full support for automatic reboots. If you want your product to be compliant with the Microsoft Windows Logo program (http://www.microsoft.com/winlogo), then it has to be released as an MSI installer. This is one good reason why all the commercial installation tools now support MSI. The main drawbacks of Windows Installer are its complexity and the size of the generated installers. Many of the restrictions imposed by earlier versions of the MSI SDK seem to have been fixed in the latest version. One interesting installation tool is WiX (http://sourceforge.net/projects/wix), which is used by Microsoft internally to create MSI files. WiX uses XML for its configuration files. There is an overview available at http://www.ondotnet.com/pub/a/dotnet/2004/04/19/wix.html. 9.5.3.2. InstallShieldInstallShield from Macrovision (http://www.installshield.com) is probably the most commonly used commercial installation tool. InstallShield is also one of the oldest such tools. It costs $2,499 for the top-level edition. Earlier configurations were not stored in XML, but they were mostly in text files. You can build installers for a number of different platforms, but most InstallShield installers appear to be for Windows. Available in English, German, and Japanese, InstallShield can produce installers in over 30 different languages. It has integrated support for Visual SourceSafe and a huge range of other features, which explains the large number of choices on every screen of the UI. Simple projects are easy enough to create using the wizards that come with the tool, but larger ones can require some time to get right. The installer debugger and the binary install logs in C:\Program Files\InstallShield Installation Information can help you greatly with this. There is a list of rather overpriced InstallShield books at InstallSite (http://www.installsite.org/pages/en/books.htm), along with a good community of users. 9.5.3.3. InstallAnywhereInstallAnywhere from ZeroG (http://www.zerog.com), now also owned by Macrovision, is a good example of a newer type of installation tool, one that uses the platform-independent nature of Java for its installers. The cost for the top-level edition is $2,999. InstallAnywhere installers are specified using XML configuration files created by a nicely uncluttered UI. Almost any platform that has a JRE (Java Runtime Environment) is supported, both for the installation tool and for the installers that it creates, so creating installers for many platforms is faster than usual. InstallAnywhere is focused on releasing Java applications; it has a documented API so you can call it from other Java applications and it even has an Ant task for creating installers. The tool is available in English, German, French, and Japanese. When you run an InstallAnywhere installer, it communicates very clearly what it is doing. There is a list of steps to show you what stage the install is in, and there are thoughtful buttons to restore choices on a page after you have messed around with them and forgotten what their original values were. The summary page that is shown after the installer has gathered all the information it needs, but before the install begins, is quite thorough.
The disadvantage of all this portability is that the customer has to have a JRE on his machine to use the installers that are generated by InstallAnywhere. This is hardly unlikely if the final application is a Java application, but it can be a hindrance to installation. InstallAnywhere does let you bundle a JRE together with the installer, but of course this makes the installer much larger. 9.5.3.4. Wise for WindowsWise for Windows from Altiris (http://www.wise.com) is the other commercial installation tool that seems to be most commonly used. The top-level edition retails for $1,999. There is a comparison of Wise for Windows and InstallShield at http://www.installsite.org/pages/en/msi/comparison.htm, and there are some more technical tips at http://www.ewall.org/ContentExpress-display-ceid-8.html. Most reviews comparing InstallShield and Wise for Windows seem to feel that the two tools are roughly comparable in what you get (both good and bad) for your money. 9.5.3.5. InnoSetupInnoSetup (http://www.jrsoftware.org/isinfo.php) is an open source installation tool by Jordan Russell. It has an active community and some enthusiastic users. However, InnoSetup runs only on Windows, produces installers only for Windows, and does not use the MSI installer format provided by Windows. There is good support for installers in languages other than English, and indeed a single installer can be run using many different languages. Since the tool is written in Delphi, Pascal is used to write any scripts that are executed by installers, but the UI is clear and a script debugger is nicely integrated into it. The documentation is concise, and there are a number of third-party tools built on top of InnoSetup. One well-known project that uses InnoSetup for its Windows releases is Subversion (see Section 4.6.2). 9.5.3.6. NSISNSIS (Nullsoft Scriptable Install System) from http://nsis.sourceforge.net is another open source installation tool that runs only on Windows and produces installers only for Windows. Originally developed by Joost Verburg for the WinAmp music player, its claim to fame is that it adds only 34KB of overhead, so its installers are almost as small as possible. Like InnoSetup, it doesn't use MSI, so you can't create installers that are Windows Logo-compliant. NSIS is used by a number of low-cost products, including Google's Gmail Notifier (http://toolbar.google.com/gmail-helper). |