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. Most users developing automated installation scripts will have purchased the Corporate license, which entitles users to a universal activation key. 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 (x86)\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 (x86) (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\Framework\v2.0.50727 or later version
  4. Install the CompleteFTP service with the command:
    InstallUtil.exe "C:\Program Files (x86)\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 (x86)\CompleteFTP (including the directory itself)
  3. Remove install.log and server\boostrapper.log from the ZIP-file

Production machine: Installation

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