How to automate installation

The CompleteFTP installer is a standard NSIS-based Windows installer, which uses a GUI to prompt for various options during installation.

Some organizations prefer to automate installations, and use command-line scripts to roll out software. A GUI-based installer is usually not suitable for this - instead a command-line installer that requires no user input is required. This article describes how to create and use command-line installers for CompleteFTP.

There's a distinction between a first-time installer and an update installer. A first-time installer is used only when a completely new installation is required, or when an existing installation is to be completely overwritten. An update installer should be used when an existing installation is to be updated to a more recent version.

The general pattern for creating and using automated installers is to:

  1. Install CompleteFTP using the standard GUI installer on one machine (the 'development' machine)
  2. Create archives of the required files
  3. Un-archive these on another machine (the 'production' machine)
  4. Execute various commands to make the software operable on that machine.
  5. If necessary, activate the installation with an activation key (AK).

The sections below don't contain the full scripts that must be executed, but rather describe the actions that must be performed.

First-Time Installation

A first-time installation is an installation onto a machine that either has no current CompleteFTP installation, or has an existing CompleteFTP installation that is to be entirely overwritten.

An activation key (AK) will be required to activate the installation. Certain Volume Licenses provide access to a universal activation key which is very suitable for automated installation as it can be done as part of the install. Without using a universal activation key, each installation will later need to be activated manually.

Development machine: Creating archives

  1. Install CompleteFTP using the standard GUI installer on the development machine
  2. Configure CompleteFTP as desired using CompleteFTP Manager
  3. Activate the installation using the universal activation key
  4. Create a ZIP file called binaries.zip that contains the directory C:\Program Files\CompleteFTP (including the directory itself)
  5. Remove install.log and server\boostrapper.log from the ZIP-file
  6. Create a ZIP file called data.zip that contains C:\ProgramData\Enterprise Distributed Technologies (including the directory itself)
  7. Remove the contents of the Temp, Logs and Backups directories from the ZIP-file
  8. Remove any unwanted directories and files from the Users directory

Production machine: Installation

  1. Unzip binaries.zip in C:\Program Files (unzip app needs admin privileges)
  2. Unzip data.zip in C:\ProgramData (unzip app needs admin privileges)
  3. Locate the InstallUtil.exe program - usually in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 or later version
  4. Install the CompleteFTP service with the command:
    InstallUtil.exe "C:\Program Files\Complete FTP\Server\CompleteFTPService.exe"
  5. Change the startup type of the service to Automatic with the command:
    reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\CompleteFTP /v Start /t REG_DWORD /d 2 /f
  6. Stop parent directory of user accounts from inheriting permissions from its parent:
    icacls "C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Users" /inheritance:d
  7. Remove read permissions for the Users group for the same folder (so that Windows users can't get a list of other users):
    icacls "C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Users" /remove:g Users
  8. Each Windows user-account which is registered in CompleteFTP must have permission to their own home-directory, so if there are any such users then use icacls to grant them
  9. Start service using the command
    net start CompleteFTP

Updating an Existing Installation

When a production installation is being updated, the new binaries may be copied over the old ones, but the configuration data on that machine must not be overwritten. The main difference between the first-time installation and the update is therefore related to the treatment of the data.

Development machine: Creating archives

  1. Update existing CompleteFTP using the standard GUI installer on the development machine
  2. Create a ZIP file called binaries.zip that contains the directory C:\Program Files\CompleteFTP
  3. Remove install.log and server\boostrapper.log from the ZIP-file
  4. Create a ZIP file called webcontent.zip that contains the following subdirectories of C:\ProgramData\Enterprise Distributed Technologies\Complete FTP:

Production machine: Installation

  1. Stop CompleteFTP Service using the command
    net stop CompleteFTP
  2. Delete the directory C:\Program Files\CompleteFTP and all its subdirectories
  3. Unzip binaries.zip in C:\Program Files (unzip app needs admin privileges)
  4. Unzip webcontent.zip in C:\ProgramData\Enterprise Distributed Technologies\Complete FTP (unzip app needs admin privileges)
  5. Update the configuration database to latest version using the command
    C:\Program Files\CompleteFTP\cftpconfig
  6. Perform any configuration modifications (see cftpconfig)
  7. Start service using the command
    net start CompleteFTP

Special notes on upgrading from pre-22.0.0 to 22.0.0 and higher

Versions prior to 22.0.0 were 32-bit applications, so all binaries were under the directory, C:\Program Files (x86)\Complete FTP. From version 22.0.0, CompleteFTP is a 64-bit application, so all binaries are under C:\Program Files\Complete FTP.

Obviously, any references to CompleteFTP files under C:\Program Files (x86)\Complete FTP will need to be modified to point to their new locations. One important change is to the CompleteFTP service, which will need to be changed to point to the new location of the service binary. The easiest way to do this is to uninstall and reinstall the service using the Windows utility InstallUtil.exe. For example:

	InstallUtil.exe  /u "C:\Program Files (x86)\Complete FTP\Server\CompleteFTPService.exe"
	InstallUtil.exe "C:\Program Files\Complete FTP\Server\CompleteFTPService.exe"
	

Version 22.0.0 also brought the shift from SQL Server Compact to SQLite, and the name of the configuration file has changed from config.sdf to config.db.