PostgreSQL 安装说明

PostgreSQL 下载

PostgreSQL 可以作为各种平台的即用包或安装程序下载,如果您想自己构建,也可以作为源代码存档下载。

https://www.postgresql.org/download/

Linux 下载 (Red Hat 系列)

Red Hat 系列发行版包括:

  • Red Hat Enterprise Linux
  • Rocky Linux
  • AlmaLinux
  • Fedora
    以及其他。

PostgreSQL 默认在这些平台上可用。然而,平台的每个版本通常都会 “快照” 一个特定的 PostgreSQL 版本,然后在该平台的整个生命周期内受到支持。由于这通常意味着与首选版本不同的版本,PostgreSQL 项目为最常见的发行版提供了一个包含所有受支持版本的软件包存储库。

PostgreSQL Yum 存储库

PostgreSQL yum 仓库将与您的常规系统和补丁管理集成,并在 PostgreSQL 的整个支持生命周期内为所有受支持的 PostgreSQL 版本提供自动更新。

PostgreSQL Yum 存储库目前支持:

  • Red Hat Enterprise Linux
  • Rocky Linux
  • AlmaLinux
  • Fedora
    注意:由于 Fedora 的支持周期较短,本平台不提供所有受支持的 PostgreSQL 版本。我们不建议使用 Fedora 进行服务器部署。

要使用 PostgreSQL Yum 仓库,请按照以下步骤操作:

  • 选择版本:
    18
  • 选择平台:
    Red Hat Enterprise, Rocky, AlmaLinux or Oracle version 10 Red Hat Enterprise、Rocky、AlmaLinux 或 Oracle 版本 10
  • 选择架构:
    x86_64
  • 复制、粘贴并运行安装脚本的相关部分:
# Install the repository RPM:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql

# Install PostgreSQL:
sudo dnf install -y postgresql18-server

# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-18/bin/postgresql-18-setup initdb
sudo systemctl enable postgresql-18
sudo systemctl start postgresql-18
作者:Jeebiz  创建时间:2025-11-03 22:24
最后编辑:Jeebiz  更新时间:2025-11-03 22:35