## 17.2. Installing Postgres Pro on Windows

Postgres Pro offers the following installation options for the supported Windows systems:

- GUI installation using an interactive wizard

- Command-line installation

Additionally, you have to set up the environment for using PL/Perl and PL/Python, if these procedural languages are required for your purposes. For details, see Section 17.2.4.

To avoid confusion, note that there are the following different users on Windows systems:

- Postgres Pro installation is performed on behalf of an operating system user. All the database files belong to this user.

- You must connect to the database cluster on behalf of the user created at installation time to be able to work with the database. This is not an operating system user.

- Postgres Pro service is started on behalf of a special Windows Service Account — `NT AUTHORITY\NetworkService`.

### 17.2.1. Supported Windows Versions

Postgres Pro supports the following Windows versions:

- Windows 7 SP1, 8.1, 10

- Windows Server 2008 R2 or higher

### 17.2.2. GUI Installation

Postgres Pro provides an installer with an interactive wizard that configures and installs all the components at once and creates the default database.

To install Postgres Pro, run the provided installer as administrator and follow the on-screen instructions. Make sure to take into account the following installation specifics:

- The selected data directory must be empty. Otherwise, Postgres Pro cannot create the default database. The default data directory is `C:/Program Files/PostgresPro/10/data`.

- If the Allow external connections check box is selected (default), the installer modifies `postgresql.conf` and `pg_hba.conf` file to allow external connections. Otherwise, Postgres Pro server is listening for connections from the localhost only. If you decide to enable external connections when the installation is complete, you have to modify the Windows Firewall configuration to allow Postgres Pro server to accept connections.

- Make sure to remember the username and password you set up when installing Postgres Pro as you have to connect to the Postgres Pro server.

- Postgres Pro provides a pre-configured psql that you can launch from the Start menu, so you do not have to configure the standard environment variables. However, if you would like to work with Postgres Pro from the standard command-line console without specifying full paths to the binary files, select the Set up environment variables check box.

- If you are going to use PL/Python and PL/Perl procedural languages, make sure to complete the setup as explained in Section 17.2.4.

### 17.2.3. Command-Line Installation

To install Postgres Pro from the command line, run the downloaded installer file passing one or more options described in Section 17.2.3.1.

#### 17.2.3.1. Command-Line Options

Installation directory path:

    /D=path

Silent install:

    /S

`INI` file that provides the options to customize the server installation:

    /init=ini_file_name

If you would like to customize the installation, you must create the `INI` file manually, as described in Section 17.2.3.2.

#### 17.2.3.2. INI File Format

In the section [options] can be these options:

- `InstallDir` — path where to install server. If you specified the /D option on the command line, it will be overwritten by the `InstallDir` value.

- `DataDir` — path where to create default database

- `Port` — TCP/IP port to listen. Default: 5432.

- `SuperUser` — name of the database user who will have admin rights in the database

- `Password` — password of the user

- `noExtConnections = 1` — do not allow external connections

- `Coding = UNICODE` — character encoding to use in the database

- `Locale` — locale to use in the database. There can be several different locales for each encoding

- `Vcredist = no` — do not install Visual C redistributable libraries (use it only if these libraries are already installed on your system)

- `envvar = 1` — set up environment variables helpful for Postgres Pro: `PGDATA`, `PGDATABASE`, `PGUSER`, `PGPORT`, `PGLOCALEDIR`

### 17.2.4. Loading Procedural Languages

Postgres Pro distribution for Windows systems includes `PL/Perl` and `PL/Python` procedural languages.

#### 17.2.4.1. Setting up the Environment for PL/Python

To configure the system for using PL/Python, complete the following steps:

1. Download and install the latest available version of Python 2.7 for Windows that corresponds to your Postgres Pro server architecture type (32-bit or 64-bit). You can find the installers at https://www.python.org/.

2. Create the PL/Python extension by running the following command in psql:

       CREATE EXTENSION plpythonu

### Tip

In some cases, when you create a PL/Python function, the connection to the server is lost and the server log shows the following error message:

    ImportError: module site not found

To avoid this issue, try to specify the Python installation directory in the `PYTHONHOME` environment variable and restart the Postgres Pro service.

#### 17.2.4.2. Setting up the Environment for PL/Perl

To configure the system for using PL/Perl, complete the following steps:

1. Download and install the latest available version of ActivePerl 5.22 that corresponds to your Postgres Pro server architecture type (32-bit or 64-bit). You can find the installers at https://www.activestate.com/activeperl/downloads.

2. Make sure to select the Add Perl to the PATH environment variable option in the installation wizard.

3. Restart the Postgres Pro server.

4. Create the PL/Perl extension by running the following command in psql:

       CREATE EXTENSION plperlu