Linux 下載(Ubuntu)PostgreSQL
PostgreSQL 默認(rèn)支持所有 Ubuntu 版本。然而,Ubuntu “快照”特定版本的PostgreSQL,隨后在整個范圍內(nèi)得到支持 該Ubuntu版本的生命周期。 PostgreSQL 項目維護一個支持 Apt 的倉庫 PostgreSQL的可用性。
包含在發(fā)行中
Ubuntu 默認(rèn)包含 PostgreSQL。要在Ubuntu上安裝PostgreSQL, 使用(或其他APT駕駛)命令:apt
apt install postgresql
PostgreSQL Apt 倉庫
如果你版本的Ubuntu不是你想要的, 你可以使用 PostgreSQL Apt Repository。該倉庫將實現(xiàn)集成 通過常規(guī)系統(tǒng)和補丁管理,自動提供 在PostgreSQL支持生命周期內(nèi),所有支持版本的更新。
PostgreSQL Apt 倉庫支持當(dāng)前版本的 Ubuntu:
任務(wù)(25.10,非LTS)
Plucky(25.04,非LTS)
高貴(24.04,LTS)
jammy(22.04,LTS)
關(guān)于以下架構(gòu):
AMD64
arm64(僅限LTS版本)
ppc64el(僅限LTS版本)
自動化存儲庫配置:
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
要手動配置Apt倉庫,請按照以下步驟作:
# Import the repository signing key:
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 http://m.lncdfzh.com.cn/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] http://m.lncdfzh.com.cn/pub/repos/apt $VERSION_CODENAME-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
# Update the package lists:
sudo apt update
安裝PostgreSQL:(用你想要的版本替換“18”)
sudo apt install postgresql-18