Debian11とPostgreSQLの最新バージョン

DjangoLinux

はじめに

Debian11(bullseye:PostgreSQL 13)で、PythonのWebアプリケーションフレームワークであるDjangoを仮想環境(pipenv)で使っています。
Djangoはできるだけ最新バージョンを維持したいですが、Django 5.2以降はPostgreSQL 14以上が必須になりました。
事情からDebianはupgradeできない状態なので、PostgreSQLだけupgradeする方法を調べました。

環境

- Debian11 bullseye

PostgreSQLのDebian対応

PostgreSQL公式がリポジトリを提供しています。

PostgreSQL: Linux downloads (Debian)

PostgreSQLのリポジトリ追加

公式の通りに実行します。
今回はmanually configureで行いました。

sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc

# Create the repository configuration file:
. /etc/os-release
sudo sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main' > /etc/apt/sources.list.d/pgdg.list"

# Update the package lists:
sudo apt update

# Install the latest version of PostgreSQL:
# If you want a specific version, use 'postgresql-17' or similar instead of 'postgresql'
sudo apt -y install postgresql

Comments