PG的定义:
与mysql的区别:
Linux下载PG的路径:
https://www.postgresql.org/download/
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql16-server
yum install yum install -y postgresql14-server
-- 环境变量
echo "export PATH=/usr/pgsql-14/bin:$PATH" >> /etc/profile
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl enable postgresql-14
sudo systemctl start postgresql-14
##检查PG14的状态
[root@gitlab yum.repos.d]# systemctl status postgresql-14
● postgresql-14.service - PostgreSQL 14 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-14.service; enabled; vendor preset: disabled)
Active: active (running) since 日 2023-11-19 22:46:44 CST; 45s ago
Docs: https://www.postgresql.org/docs/14/static/
Process: 6282 ExecStartPre=/usr/pgsql-14/bin/postgresql-14-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 6287 (postmaster)
Tasks: 8
Memory: 5.4M
CGroup: /system.slice/postgresql-14.service
├─6287 /usr/pgsql-14/bin/postmaster -D /var/lib/pgsql/14/data/
├─6289 postgres: logger
├─6291 postgres: checkpointer
├─6292 postgres: background writer
├─6293 postgres: walwriter
├─6294 postgres: autovacuum launcher
├─6295 postgres: stats collector
└─6296 postgres: logical replication launcher
11月 19 22:46:44 gitlab systemd[1]: Starting PostgreSQL 14 database server...
11月 19 22:46:44 gitlab postmaster[6287]: 2023-11-19 22:46:44.669 CST [6287] 日志: 日志输出重定向到日志收集进程
11月 19 22:46:44 gitlab postmaster[6287]: 2023-11-19 22:46:44.669 CST [6287] 提示: 后续的日志输出将出现在目录 "log"中.
11月 19 22:46:44 gitlab systemd[1]: Started PostgreSQL 14 database server.
Hint: Some lines were ellipsized, use -l to show in full.
##检查PG的端口:5432
[root@gitlab yum.repos.d]# netstat -ntulp |grep -i 5432
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 6287/postmaster
tcp6 0 0 ::1:5432 :::* LISTEN 6287/postmaster
标签:postgresql,14,22,6287,学习,yum,PostgreSQL,安装,postgres From: https://www.cnblogs.com/cherishthepresent/p/17842929.html