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

# Upgrading Postgres

Anaconda Server versions `6.6.1` and prior utilize Postgres version `9.6` for new installations. However, [as of November 2021](https://endoflife.date/postgresql) Postgres `9.6` is end of life (EOL).

Anaconda Server version `6.6.2` and later utilize Postgres version `14.9` for new installations. If you have upgraded to Anaconda Server `6.6.2` or later, Anaconda recommends upgrading your version of Postgres manually. Anaconda Server is tested and known to be compatible and stable with this version of Postgres.

<Warning>
  Upgrading Postgres will bring down your Anaconda Server instance for a short time.
</Warning>

1. Log in to your instance of Anaconda Server as a user with root access.

2. Open your Anaconda Server installer directory by running the following command. This directory contains both the `docker-compose.yml` and `.env` files.

   <Tip>
     You can find your installer directory by running the `ls -la` command to view the contents of your current working directory.
   </Tip>

   ```sh theme={null}
   # Replace <INSTALLER_DIRECTORY> with your base installer directory
   cd <INSTALLER_DIRECTORY>
   ```

3. Verify you are running Postgres `9.6` by running the following command:

   ```sh theme={null}
   docker ps
   ```

4. Stop all services by running the following command:

   ```sh theme={null}
   docker compose down
   ```

5. Restart the Postgres container by running the following command:

   ```sh theme={null}
   docker compose up -d postgres
   ```

6. Export your Postgres database by running the following command:

   ```sh theme={null}
   docker exec -i postgres pg_dumpall -U postgres > dump.sql
   ```

7. Using your preferred file editor, open your `.env` file and update or add the following lines:

   ```sh theme={null}
   POSTGRES_VERSION=14.9
   POSTGRES_MAJOR=14
   ```

8. Save your work and close the file.

9. Restart the containers by running the following command:

   ```sh theme={null}
   docker compose up -d
   ```

10. Allow the containers to come back online then verify you are using Postgres version `14.9` by running the following command:

    ```sh theme={null}
    docker ps
    ```
