CentOS 7 上安装 PostgreSQL 13 (RPM方式)
CentOS 7 上安装 PostgreSQL 13 (RPM方式)
本文将指导您如何在 CentOS 7 上使用 RPM 包安装 PostgreSQL 13 数据库系统。
步骤 1: 安装 PostgreSQL 的 RPM 仓库
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
步骤 2: 安装 PostgreSQL 13
yum install -y postgresql13-server postgresql13-contrib
步骤 3: 初始化数据库
/usr/pgsql-13/bin/postgresql-13-setup initdb
步骤 4: 启动 PostgreSQL 服务
systemctl enable postgresql-13
systemctl start postgresql-13
步骤 5: 设置 PostgreSQL 管理员密码
sudo -u postgres psql
ALTER USER postgres PASSWORD 'new_password';
步骤 6: 测试安装
psql -U postgres -h localhost
注意: PostgreSQL 目前最新的稳定版本为 13,尚未发布 15 版本。上述步骤适用于安装 PostgreSQL 13。
原文地址: https://www.cveoy.top/t/topic/oN7P 著作权归作者所有。请勿转载和采集!