> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manual Installation Instructions - Database Tier - PostgreSQL

> This page provides the system requirements and installation instructions for the FlexDeploy database tier on PostgreSQL. Requirements See for details

This page provides the system requirements and installation instructions for the FlexDeploy database tier on PostgreSQL.

# Requirements

See [FlexDeploy System Requirements](https://docs.flexagon.com/flexdeploy-10-0-documentation/flexdeploy-system-requirements.md) for details on software and hardware requirements.

# Automated Installer Instructions

If you are using the [automated installer](https://flexagon.atlassian.net/wiki/spaces/SHAR/pages/10125805231/Automated+Linux+Install+Upgrade), do not follow this guide.

# Manual Schema Creation

> [!TIP]
>
> You must be in **/database/postgres/install** folder from extracted zip when executing scripts.

FlexDeploy uses three schemas (FD, FF, and FD\_ADMIN) in the database and performs all work using the FD\_ADMIN user. Run database scripts from where you extracted downloaded FlexDeploy zip file. Navigate to the **/database/postgres/install** directory.

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590908521.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=1bba06f859fbc03a4005ac0802f5abb3)

**Step 1**. You should set the FD\_ADMIN password before running the scripts.

* Open the file \<FlexDeploy Unzip Folder>/database/postgres/install/scripts/CreateSchemas.sql

* Edit the line: CREATE USER FD\_ADMIN with password 'welcome1'; so that it has a new password in it.

> [!NOTE]
>
> You should record the FD\_ADMIN password, as that will be used in configuration of data source on application server.

**Step 2**. Install PostgreSQL database, if you have not done that already. Follow guidelines for your platform as documented in PostgreSQL documentation.

**Step 3**. Create *flexdeploy* database.

> [!NOTE]
>
> Database name is setup as *flexdeploy* various documentation steps, you are free to use different name. If you use database name other than *flexdeploy*, then consider following points.
>
> 1. Modify commands below appropriately for different database name.
>
> 2. Modify \<FlexDeploy Unzip Folder>/database/postgres/install/scripts/CreateSchemas.sql, statement "GRANT CONNECT ON DATABASE flexdeploy TO FD\_ADMIN;" should be modified for proper database name.
>
> 3. Adjust JDBC URL in context.xml appropriately during application installation.

These are high level steps, you can find more detailed steps in PostgreSQL documentation.

```
cd <PosgreSQL Install Home>\pgsql\bin
initdb.exe -D <Data Folder> --username=postgres --auth=trust
pg_ctl -D <Data Folder> -l logfile start
pg_ctl start -l <Data Folder>\server.log -D <Data Folder>
createdb flexdeploy
```

**Step 4**. Create FlexDeploy schema objects.

* Open a command prompt or putty window to the **\<FlexDeploy Unzip Folder>/database/postgres/install** folder from extracted zip, launch psql (use full path if not available on PATH environment)

* Run as a user like **postgres** with privileges to create users and schemas within that database. You may be prompted for password, enter password for user (with -U argument) that you use in psql command.

* Change the bold text as needed in your environment.

* Run the appropriate command below.

#### Linux

* Run FlexDeploy scripts. Type the password when asked. PostgresDDL.txt records the output of the script so that you can refer back to it later.

```
cd <Flexdeploy Unzip Folder>\database\postgres\install
/path/to/psql -U postgres -h hostname -p 5432 -d flexdeploy -a -b -e -f CreateFlexDeploySchemas.sql > PostgresDDL.txt
```

#### Windows

* Run FlexDeploy scripts. Type the password when asked. **PostgresDDL.txt** records the output of the script so that you can refer back to it later. 

```
cd <Unzip Folder>/database/postgres/install
<Path to psql.exe> -U postgres -h hostname -p 5432 -d flexdeploy -a -b -e -f CreateFlexDeploySchemas.sql > PostgresDDL.txt
```
