Select a documentation version: <button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">15.5.4</button>

- [15.7.0](https://docs.cloud.google.com/alloydb/omni/kubernetes/15.7.0/docs/migrate-to-latest-version.md.txt)
- [15.5.5](https://docs.cloud.google.com/alloydb/omni/kubernetes/15.5.5/docs/migrate-to-latest-version.md.txt)
- [15.5.4](https://docs.cloud.google.com/alloydb/omni/kubernetes/15.5.4/docs/migrate-to-latest-version.md.txt)

<br />

Starting with AlloyDB Omni 15.5.4, you control AlloyDB Omni with common package-management tools.

<br />

If you have an existing installation of AlloyDB Omni, follow the instructions on this page to migrate to the new, single-image installation.

## Prerequisites

Before you can start upgrading to the latest version of AlloyDB Omni, complete the following prerequisites, if you haven't done so already.

### Upgrade to AlloyDB Omni 15.5.2

The latest AlloyDB Omni version that supports the AlloyDB Omni CLI is 15.5.2.
To check the version of AlloyDB Omni, run the following command:

```bash
sudo alloydb version
```

The output looks similar to the following:

    AlloyDB Omni CLI version: 1.6
    AlloyDB Omni database server version: 15.5.2

If the output displays a database version earlier than 15.5.2, run the following command to upgrade:

```bash
sudo alloydb database-server upgrade
```

### Gather information about your existing installation

1. Run the following command:

   ```bash
   cat /var/alloydb/config/dataplane.conf
   ```
2. From the output of the `cat` command, note the values of the following variables for your reference:

   - `DATADIR_PATH`---for example, `/var/alloydb/main`
   - `ENABLE_ALLOYDB_AI`---for example, `FALSE`
   - `PGPORT`---for example, `5432`
   - `INSTANCE_TYPE`---for example, `PRIMARY/READ_REPLICA`

## Perform an in-place upgrade

1. Stop the existing database:

   ```bash
   sudo alloydb database-server stop
   ```
2. Start the new single-image AlloyDB Omni, mounting your existing data directory from before:

   ```bash
   docker run --name CONTAINER_NAME \
       -e POSTGRES_PASSWORD=PASSWORD \
       -e PGDATA=/var/lib/postgresql/data \
       -v /var/alloydb/main/data:/var/lib/postgresql/data \
       -v /dev/shm:/dev/shm \
       -p PGPORT:5432 \
       --network=host \
       --ulimit=nice=-20:-20 \
       --ulimit=core=-1:-1 \
       --log-driver=journald \
       -d google/alloydbomni:15.5.4
   ```

   Replace the following:
   - `CONTAINER_NAME`: The name to assign this new AlloyDB Omni container in your host machine's container registry---for example, `my-omni`.

   - `PASSWORD`: The password assigned the new container's `postgres` user after its creation.

   - `PGPORT`: The IP address of the port the AlloyDB Omni runs on. This is the value you noted down in step 2 of [Gather information about your existing installation](https://docs.cloud.google.com/alloydb/omni/kubernetes/15.5.4/docs/migrate-to-latest-version.md.txt#gather-information).

   The arguments to `docker run` are the ones used in earlier versions of AlloyDB Omni, but you may further customize them. See [Customize your AlloyDB Omni installation](https://docs.cloud.google.com/alloydb/omni/kubernetes/15.5.4/docs/install.md.txt) for details.
3. If your database instance type is `PRIMARY`, run the following command to create the following users. These are usernames which are unused at the moment, but reserved for future extensions.

   ```bash
   for name in alloydbagent alloydbexport alloydbiamgroupuser alloydbiamuser alloydbimportexport alloydbobservability alloydbsqllogical alloydbsuperuser; do
     echo docker exec -it CONTAINER_NAME psql -h localhost -U postgres alloydbadmin \
       -c "CREATE ROLE ${name} NOLOGIN;" \
       -c "CREATE TABLE ${name}_table();" \
       -c "ALTER TABLE ${name}_table OWNER TO ${name};"
   done
   ```
4. If `ENABLE_ALLOYDB_AI` is set to `TRUE`, follow instructions in [Install AlloyDB Omni with AlloyDB AI](https://docs.cloud.google.com/alloydb/omni/kubernetes/15.5.4/docs/install-with-alloydb-ai.md.txt) to set up AlloyDB AI.

5. Connect to the database to verify that the data is unchanged:

   ```bash
   docker exec -it CONTAINER_NAME psql -h localhost -U postgres
   ```
6. Uninstall the AlloyDB Omni CLI:

   ```bash
   sudo alloydb database-server uninstall
   ```

   The AlloyDB Omni CLI uninstallation does not affect your data stored in AlloyDB Omni.