1. postgresql 官网关于需要安装的包和依赖:
来源:https://yum.postgresql.org/14/redhat/rhel-7-x86_64/repoview/postgresqldbserver14.group.html
2. 四个包都下载下来:
3. 进行PostgresSQL的安装
[root@db-postgresql13 home]# rpm -ivh postgresql14-*
4. 初始化db
[root@db-postgresql13 home]# /usr/pgsql-13/bin/postgresql-13-setup initdb
Initializing database ... OK
5. 启动PostgreSQL服务
[root@db-postgresql13 home]# systemctl start postgresql-13
# 查看服务状态
[root@db-postgresql13 ~]# systemctl status postgresql-13
6. 进入PostgreSQL数据库
[root@db-postgresql13 ~]# su - postgres
Last login: Tue Jun 22 11:13:17 CST 2021 on pts/1 # 查看postgresql版本 -bash-4.2$ psql --version psql (PostgreSQL) 13.3 # 进入数据库 -bash-4.2$ psql psql (13.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (3 rows) postgres=#
7. 下面是 13 安装日志
================================================================================================================================================================================================================================================= Package 架构 版本 源 大小 ================================================================================================================================================================================================================================================= 正在安装: postgresql13-contrib x86_64 13.7-1PGDG.rhel7 pgdg13 613 k postgresql13-server x86_64 13.7-1PGDG.rhel7 pgdg13 5.4 M 为依赖而安装: postgresql13 x86_64 13.7-1PGDG.rhel7 pgdg13 1.4 M postgresql13-libs x86_64 13.7-1PGDG.rhel7 pgdg13 384 k 事务概要 ================================================================================================================================================================================================================================================= 安装 2 软件包 (+2 依赖软件包) 总下载量:7.8 M 安装大小:33 M Downloading packages: 警告:/var/cache/yum/x86_64/7/pgdg13/packages/postgresql13-13.7-1PGDG.rhel7.x86_64.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID 442df0f8: NOKEY ] 408 kB/s | 1.7 MB 00:00:15 ETA postgresql13-13.7-1PGDG.rhel7.x86_64.rpm 的公钥尚未安装 (1/4): postgresql13-13.7-1PGDG.rhel7.x86_64.rpm | 1.4 MB 00:00:05 (2/4): postgresql13-libs-13.7-1PGDG.rhel7.x86_64.rpm | 384 kB 00:00:00 (3/4): postgresql13-contrib-13.7-1PGDG.rhel7.x86_64.rpm | 613 kB 00:00:06 (4/4): postgresql13-server-13.7-1PGDG.rhel7.x86_64.rpm | 5.4 MB 00:00:10 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 492 kB/s | 7.8 MB 00:00:16 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG 检索密钥 导入 GPG key 0x442DF0F8: 用户ID : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>" 指纹 : 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8 软件包 : pgdg-redhat-repo-42.0-24.noarch (installed) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : postgresql13-libs-13.7-1PGDG.rhel7.x86_64 1/4 正在安装 : postgresql13-13.7-1PGDG.rhel7.x86_64 2/4 正在安装 : postgresql13-server-13.7-1PGDG.rhel7.x86_64 3/4 正在安装 : postgresql13-contrib-13.7-1PGDG.rhel7.x86_64 4/4 验证中 : postgresql13-server-13.7-1PGDG.rhel7.x86_64 1/4 验证中 : postgresql13-contrib-13.7-1PGDG.rhel7.x86_64 2/4 验证中 : postgresql13-13.7-1PGDG.rhel7.x86_64 3/4 验证中 : postgresql13-libs-13.7-1PGDG.rhel7.x86_64 4/4 已安装: postgresql13-contrib.x86_64 0:13.7-1PGDG.rhel7 postgresql13-server.x86_64 0:13.7-1PGDG.rhel7 作为依赖被安装: postgresql13.x86_64 0:13.7-1PGDG.rhel7 postgresql13-libs.x86_64 0:13.7-1PGDG.rhel7 完毕!