Unattended installation of the Apache server

This weekend I’ve spent some time trying to create an unattended installer for Apache, MySQL, PHP and a few other services and applications I’m using when developing PHP applications. The installation process for most of the applications I’m using follows a standard procedure of unpacking the zipped archive and modifying configuration files. But Apache is available only as MSI package and there are almost no information about unattended Apache installation. So I did a small investigation and here it is.

First of all, MSI extension defines that the installation process is intended to be handled by Microsoft Installer. The main installer executable is “msiexec.exe”, which is located in the “c:\windows\system32” folder. The command line options of this file allows you to choose between installing, uninstalling or repairing of the package, to select different logging levels, etc. When executing this executable with MSI package specified, you can also define installer properties, like install folder, by specifying KEY=VALUE pairs.

And, what is very important, it has a set of options that allows to specify how the installation process will run: quiet (without user interaction), passive (unattended mode with progress bar only), without UI, with basic UI, reduced UI, or with full UI. You can see a full list of the options by executing

msiexec.exe /?

So, with msiexec.exe you can install the Apache package but only with default installation options. To overwrite the installer options you should know them but where to get them??? Actually, I’m not familiar with MSI and how the parameters are defined, but search for site:apache.org INSTALLDIR APACHEDIR returns interesting results. Actually, INSTALLDIR is enough for me now, but you can find in the search results APACHEBINDIR, APACHEMODULESDIR, SERVICENAME, SERVERSSLPORT and a lot of other strings that seem to be installer options.

And finally, the following example shows how to install currently available Apache package, named “apache_2.2.3-win32-x86-no_ssl.msi”, in unattended mode and with changed INSTALLDIR property:

msiexec.exe /passive /package apache_2.2.3-win32-x86-no_ssl.msi INSTALLDIR=C:\apache