CentOS 7.6.1810
postgresql 14.4
centos7安装pgsql14(yum)
[root@localhost ysym]# groupadd -g 2000 postgres
[root@localhost ysym]# useradd -u 2000 -g 2000 postgres
[root@localhost ysym]# id postgres
uid=2000(postgres) gid=2000(postgres) groups=2000(postgres)
复制
[root@localhost ysym]# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: fastestmirror, langpacks
pgdg-redhat-repo-latest.noarch.rpm | 8.1 kB 00:00:00
Examining /var/tmp/yum-root-p3DkG7/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-24.noarch
Marking /var/tmp/yum-root-p3DkG7/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-24 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
pgdg-redhat-repo noarch 42.0-24 /pgdg-redhat-repo-latest.noarch 11 k
Transaction Summary
============================================================================================
Install 1 Package
Total size: 11 k
Installed size: 11 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pgdg-redhat-repo-42.0-24.noarch 1/1
Verifying : pgdg-redhat-repo-42.0-24.noarch 1/1
Installed:
pgdg-redhat-repo.noarch 0:42.0-24
Complete!
[root@localhost ysym]# yum install -y postgresql14-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
pgdg-common/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg-common/7/x86_64/signature | 2.9 kB 00:00:00 !!!
pgdg10/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg10/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg11/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg11/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg12/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg12/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg13/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg13/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg14/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg14/7/x86_64/signature | 3.6 kB 00:00:00 !!!
(1/11): pgdg11/7/x86_64/group_gz | 245 B 00:00:01
(2/11): pgdg10/7/x86_64/group_gz | 245 B 00:00:01
(3/11): pgdg12/7/x86_64/group_gz | 245 B 00:00:00
(4/11): pgdg10/7/x86_64/primary_db | 381 kB 00:00:01
(5/11): pgdg13/7/x86_64/group_gz | 246 B 00:00:00
(6/11): pgdg13/7/x86_64/primary_db | 194 kB 00:00:00
(7/11): pgdg14/7/x86_64/primary_db | 115 kB 00:00:00
(8/11): pgdg14/7/x86_64/group_gz | 244 B 00:00:00
(9/11): pgdg-common/7/x86_64/primary_db | 162 kB 00:00:02
(10/11): pgdg11/7/x86_64/primary_db | 411 kB 00:00:02
(11/11): pgdg12/7/x86_64/primary_db | 290 kB 00:00:03
Resolving Dependencies
--> Running transaction check
---> Package postgresql14-server.x86_64 0:14.4-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql14-libs(x86-64) = 14.4-1PGDG.rhel7 for package: postgresql14-server-14.4-1PGDG.rhel7.x86_64
--> Processing Dependency: postgresql14(x86-64) = 14.4-1PGDG.rhel7 for package: postgresql14-server-14.4-1PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql14-server-14.4-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package postgresql14.x86_64 0:14.4-1PGDG.rhel7 will be installed
---> Package postgresql14-libs.x86_64 0:14.4-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
postgresql14-server x86_64 14.4-1PGDG.rhel7 pgdg14 5.5 M
Installing for dependencies:
postgresql14 x86_64 14.4-1PGDG.rhel7 pgdg14 1.5 M
postgresql14-libs x86_64 14.4-1PGDG.rhel7 pgdg14 268 k
Transaction Summary
============================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 7.2 M
Installed size: 31 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/pgdg14/packages/postgresql14-libs-14.4-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Public key for postgresql14-libs-14.4-1PGDG.rhel7.x86_64.rpm is not installed
(1/3): postgresql14-libs-14.4-1PGDG.rhel7.x86_64.rpm | 268 kB 00:00:01
(2/3): postgresql14-server-14.4-1PGDG.rhel7.x86_64.rpm | 5.5 MB 00:00:01
(3/3): postgresql14-14.4-1PGDG.rhel7.x86_64.rpm | 1.5 MB 00:00:10
--------------------------------------------------------------------------------------------
Total 702 kB/s | 7.2 MB 00:00:10
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
Package : pgdg-redhat-repo-42.0-24.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : postgresql14-libs-14.4-1PGDG.rhel7.x86_64 1/3
Installing : postgresql14-14.4-1PGDG.rhel7.x86_64 2/3
Installing : postgresql14-server-14.4-1PGDG.rhel7.x86_64 3/3
Verifying : postgresql14-server-14.4-1PGDG.rhel7.x86_64 1/3
Verifying : postgresql14-14.4-1PGDG.rhel7.x86_64 2/3
Verifying : postgresql14-libs-14.4-1PGDG.rhel7.x86_64 3/3
Installed:
postgresql14-server.x86_64 0:14.4-1PGDG.rhel7
Dependency Installed:
postgresql14.x86_64 0:14.4-1PGDG.rhel7 postgresql14-libs.x86_64 0:14.4-1PGDG.rhel7
Complete!
[root@localhost ysym]#
[root@localhost ysym]# rpm -qi postgresql14
Name : postgresql14
Version : 14.4
Release : 1PGDG.rhel7
Architecture: x86_64
Install Date: Tue 12 Jul 2022 08:37:28 PM CST
Group : Unspecified
Size : 8235039
License : PostgreSQL
Signature : DSA/SHA1, Thu 16 Jun 2022 08:23:24 PM CST, Key ID 1f16d2e1442df0f8
Source RPM : postgresql14-14.4-1PGDG.rhel7.src.rpm
Build Date : Thu 16 Jun 2022 07:34:18 PM CST
Build Host : koji-centos7-x86-64-pgbuild
Relocations : (not relocatable)
Vendor : PostgreSQL Global Development Group
URL : https://www.postgresql.org/
Summary : PostgreSQL client programs and libraries
Description :
PostgreSQL is an advanced Object-Relational database management system (DBMS).
The base postgresql package contains the client programs that you'll need to
access a PostgreSQL DBMS server, as well as HTML documentation for the whole
system. These client programs can be located on the same machine as the
PostgreSQL server, or on a remote machine that accesses a PostgreSQL server
over a network connection. The PostgreSQL server can be found in the
postgresql14-server sub-package.
If you want to manipulate a PostgreSQL database on a local or remote PostgreSQL
server, you need this package. You also need to install this package
if you're installing the postgresql14-server package.
复制
[root@localhost ysym]# ls /usr/pgsql-14/bin/
clusterdb pg_basebackup pg_dumpall pg_test_timing postmaster
createdb pgbench pg_isready pg_upgrade psql
createuser pg_checksums pg_receivewal pg_verifybackup reindexdb
dropdb pg_config pg_resetwal pg_waldump vacuumdb
dropuser pg_controldata pg_restore postgres
initdb pg_ctl pg_rewind postgresql-14-check-db-dir
pg_archivecleanup pg_dump pg_test_fsync postgresql-14-setup
[root@localhost ysym]# ls /usr/pgsql-14/bin/
clusterdb pg_basebackup pg_dumpall pg_test_timing postmaster
createdb pgbench pg_isready pg_upgrade psql
createuser pg_checksums pg_receivewal pg_verifybackup reindexdb
dropdb pg_config pg_resetwal pg_waldump vacuumdb
dropuser pg_controldata pg_restore postgres
initdb pg_ctl pg_rewind postgresql-14-check-db-dir
pg_archivecleanup pg_dump pg_test_fsync postgresql-14-setup
复制
[root@localhost ysym]# vim /etc/profile
[root@localhost ysym]# source /etc/profile
[root@localhost ysym]# /usr/pgsql-14/bin/postgresql-14-setup initdb
Initializing database ... OK
[root@localhost ysym]# ls /var/lib/pgsql/14/data/
base pg_dynshmem pg_multixact pg_snapshots pg_tblspc pg_xact
global pg_hba.conf pg_notify pg_stat pg_twophase postgresql.auto.conf
log pg_ident.conf pg_replslot pg_stat_tmp PG_VERSION postgresql.conf
pg_commit_ts pg_logical pg_serial pg_subtrans pg_wal
[root@localhost ysym]# systemctl enable postgresql-14.service
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-14.service to /usr/lib/systemd/system/postgresql-14.service.
[root@localhost ysym]# systemctl start postgresql-14.service
[root@localhost ysym]# systemctl status postgresql-14.service
● postgresql-14.service - PostgreSQL 14 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-14.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-07-12 20:43:18 CST; 5s ago
Docs: https://www.postgresql.org/docs/14/static/
Process: 73126 ExecStartPre=/usr/pgsql-14/bin/postgresql-14-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 73135 (postmaster)
Tasks: 8
CGroup: /system.slice/postgresql-14.service
├─73135 /usr/pgsql-14/bin/postmaster -D /var/lib/pgsql/14/data/
├─73137 postgres: logger
├─73139 postgres: checkpointer
├─73140 postgres: background writer
├─73141 postgres: walwriter
├─73142 postgres: autovacuum launcher
├─73143 postgres: stats collector
└─73144 postgres: logical replication launcher
Jul 12 20:43:18 localhost.localdomain systemd[1]: Starting PostgreSQL 14 database server...
Jul 12 20:43:18 localhost.localdomain postmaster[73135]: 2022-07-12 20:43:18.225 CST [73...s
Jul 12 20:43:18 localhost.localdomain postmaster[73135]: 2022-07-12 20:43:18.225 CST [73....
Jul 12 20:43:18 localhost.localdomain systemd[1]: Started PostgreSQL 14 database server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ysym]#
复制
[root@localhost ysym]# su - postgres
[postgres@localhost ~]$ psql
psql (14.4)
Type "help" for help.
postgres=# \d
Did not find any relations.
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=# \q
复制
学习资料
欢迎各位同学一起来交流学习心得!
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
文章被以下合辑收录
评论
相关阅读
外国CTO也感兴趣的开源数据库项目——openHalo
小满未满、
548次阅读
2025-04-21 16:58:09
9.9 分高危漏洞,尽快升级到 pgAdmin 4 v9.2 进行修复
严少安
358次阅读
2025-04-11 10:43:23
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
337次阅读
2025-04-15 14:48:05
openHalo问世,全球首款基于PostgreSQL兼容MySQL协议的国产开源数据库
严少安
313次阅读
2025-04-07 12:14:29
转发有奖 | PostgreSQL 16 PGCM高级认证课程直播班招生中!
墨天轮小教习
152次阅读
2025-04-14 15:58:34
墨天轮PostgreSQL认证证书快递已发(2025年3月批)
墨天轮小教习
133次阅读
2025-04-03 11:43:25
SQL 优化之 OR 子句改写
xiongcc
97次阅读
2025-04-21 00:08:06
融合Redis缓存的PostgreSQL高可用架构
梧桐
91次阅读
2025-04-08 06:35:40
PostgreSQL拓展PGQ实现解析
chirpyli
89次阅读
2025-04-07 11:23:17
Mysql/Oracle/Postgresql快速批量生成百万级测试数据sql
hongg
78次阅读
2025-04-07 15:32:54
TA的专栏
目录