镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

centos换源+安装postgresql

http://mirror.nsc.liu.se/centos-store/8.2.2004/isos/x86_64/ 镜像安装网站

https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.24.0.tar.xz git版本网站

1 更换阿里源

  1. [ivanlee@localhost Desktop]$ cd /etc/yum.repos.d
  2. [ivanlee@localhost yum.repos.d]$ ls
  3. CentOS-AppStream.repo CentOS-Devel.repo CentOS-PowerTools.repo
  4. CentOS-Base.repo CentOS-Extras.repo CentOS-Sources.repo
  5. CentOS-centosplus.repo CentOS-fasttrack.repo CentOS-Vault.repo
  6. CentOS-CR.repo CentOS-HA.repo
  7. CentOS-Debuginfo.repo CentOS-Media.repo

首先全部删除源的所有文件,遇到所有的询问都是y

  1. [root@localhost yum.repos.d]# rm *.repo
  2. rm: remove regular file 'CentOS-AppStream.repo'? y
  3. ·························

安装新的阿里源

  1. [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  2. --2022-03-22 13:53:56-- https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  3. Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 139.227.225.136, 2408:8744:803:2:3::3fe, 2408:8744:803:2:3::3fd
  4. Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|139.227.225.136|:443... connected.
  5. HTTP request sent, awaiting response... 200 OK
  6. Length: 2495 (2.4K) [application/octet-stream]
  7. Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo
  8. /etc/yum.repos.d/CentOS-Base.repo 100%[==========================================================================================================>] 2.44K --.-KB/s in 0s
  9. 2022-03-22 13:54:01 (60.0 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo saved [2495/2495]
  10. [root@localhost yum.repos.d]# yum makecache
  11. CentOS-8.5.2111 - Base - mirrors.aliyun.com 437 kB/s | 4.6 MB 00:10
  12. CentOS-8.5.2111 - Extras - mirrors.aliyun.com 1.0 kB/s | 10 kB 00:10
  13. CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 739 kB/s | 8.4 MB 00:11
  14. Metadata cache created.

如果遇到无法解析网址的情况:

  1. [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  2. --2022-05-07 15:42:13-- https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  3. Resolving mirrors.aliyun.com (mirrors.aliyun.com)... failed: Name or service not known.
  4. wget: unable to resolve host address 'mirrors.aliyun.com'

那就对本地/etc/resolv.conf文件进行修改,添加如下字段

  1. nameserver 8.8.8.8
  2. nameserver 8.8.4.4

再继续就好了

手动安装pgsql

  1. [root@localhost yum.repos.d]# dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
  2. Last metadata expiration check: 0:00:35 ago on Tue 22 Mar 2022 01:54:51 PM CST.
  3. pgdg-redhat-repo-latest.noarch.rpm 2.0 kB/s | 13 kB 00:06
  4. Dependencies resolved.
  5. =====================================================================================================================================================================================================
  6. Package Architecture Version Repository Size
  7. =====================================================================================================================================================================================================
  8. Installing:
  9. pgdg-redhat-repo noarch 42.0-24 @commandline 13 k
  10. Transaction Summary
  11. =====================================================================================================================================================================================================
  12. Install 1 Package
  13. Total size: 13 k
  14. Installed size: 12 k
  15. Is this ok [y/N]: y
  16. Downloading Packages:
  17. Running transaction check
  18. Transaction check succeeded.
  19. Running transaction test
  20. Transaction test succeeded.
  21. Running transaction
  22. Preparing : 1/1
  23. Installing : pgdg-redhat-repo-42.0-24.noarch 1/1
  24. Verifying : pgdg-redhat-repo-42.0-24.noarch 1/1
  25. Installed products updated.
  26. Installed: pgdg-redhat-repo-42.0-24.noarch Complete!
  27. [root@localhost yum.repos.d]# dnf module list postgresql
  28. PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64 15 B/s | 195 B 00:12
  29. PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  30. Importing GPG key 0x442DF0F8:
  31. Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  32. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  33. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  34. Is this ok [y/N]: y
  35. PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64 30 kB/s | 619 kB 00:20
  36. PostgreSQL 14 for RHEL / Rocky 8 - x86_64 15 B/s | 195 B 00:12
  37. PostgreSQL 14 for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  38. Importing GPG key 0x442DF0F8:
  39. Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  40. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  41. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  42. Is this ok [y/N]: y
  43. PostgreSQL 14 for RHEL / Rocky 8 - x86_64 11 kB/s | 208 kB 00:19
  44. PostgreSQL 13 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  45. PostgreSQL 13 for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  46. Importing GPG key 0x442DF0F8:
  47. Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  48. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  49. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  50. Is this ok [y/N]: y
  51. PostgreSQL 13 for RHEL / Rocky 8 - x86_64 26 kB/s | 526 kB 00:19
  52. PostgreSQL 12 for RHEL / Rocky 8 - x86_64 15 B/s | 195 B 00:12
  53. PostgreSQL 12 for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  54. Importing GPG key 0x442DF0F8: Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  55. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  56. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  57. Is this ok [y/N]: y
  58. PostgreSQL 12 for RHEL / Rocky 8 - x86_64 36 kB/s | 694 kB 00:19
  59. PostgreSQL 11 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  60. PostgreSQL 11 for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  61. Importing GPG key 0x442DF0F8:
  62. Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  63. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  64. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  65. Is this ok [y/N]: y
  66. PostgreSQL 11 for RHEL / Rocky 8 - x86_64 41 kB/s | 885 kB 00:21
  67. PostgreSQL 10 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  68. PostgreSQL 10 for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  69. Importing GPG key 0x442DF0F8:
  70. Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  71. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  72. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  73. Is this ok [y/N]: y
  74. PostgreSQL 10 for RHEL / Rocky 8 - x86_64 29 kB/s | 588 kB 00:20
  75. CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
  76. Name Stream Profiles Summary
  77. postgresql 9.6 client, server [d] PostgreSQL server and client module
  78. postgresql 10 [d] client, server [d] PostgreSQL server and client module
  79. postgresql 12 client, server [d] PostgreSQL server and client module
  80. postgresql 13 client, server [d] PostgreSQL server and client module
  81. Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
  1. [root@localhost ~]# dnf module disable postgresql
  2. PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  3. PostgreSQL 14 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  4. PostgreSQL 13 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  5. PostgreSQL 12 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  6. Dependencies resolved.
  7. =====================================================================================================================================================================================================
  8. Package Architecture Version Repository Size
  9. =====================================================================================================================================================================================================
  10. Disabling modules:
  11. postgresql
  12. Transaction Summary
  13. =====================================================================================================================================================================================================
  14. Is this ok [y/N]: y
  15. Complete!

安装pgsql12

  1. [root@localhost ~]# dnf install postgresql12
  2. Last metadata expiration check: 0:08:39 ago on Tue 22 Mar 2022 02:00:31 PM CST.
  3. All matches were filtered out by modular filtering for argument: postgresql12
  4. Error: Unable to find a match: postgresql12
  5. [root@localhost ~]# dnf config-manager --disable pgdg11
  6. [root@localhost ~]# dnf config-manager --disable pgdg10
  7. [root@localhost ~]# dnf config-manager --disable pgdg96
  8. Error: No matching repo to modify: pgdg96.
  9. [root@localhost ~]# dnf module disable postgresql
  10. PostgreSQL common RPMs for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  11. PostgreSQL 14 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  12. PostgreSQL 13 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  13. PostgreSQL 12 for RHEL / Rocky 8 - x86_64 16 B/s | 195 B 00:12
  14. Dependencies resolved.
  15. =====================================================================================================================================================================================================
  16. Package Architecture Version Repository Size
  17. =====================================================================================================================================================================================================
  18. Disabling modules:
  19. postgresql
  20. Transaction Summary
  21. =====================================================================================================================================================================================================
  22. Is this ok [y/N]: y
  23. Complete!
  24. [root@localhost ~]# dnf install postgresql12
  25. Last metadata expiration check: 0:01:29 ago on Tue 22 Mar 2022 02:10:45 PM CST.
  26. Dependencies resolved.
  27. =====================================================================================================================================================================================================
  28. Package Architecture Version Repository Size
  29. =====================================================================================================================================================================================================
  30. Installing:
  31. postgresql12 x86_64 12.10-1PGDG.rhel8 pgdg12 1.7 M
  32. Installing dependencies:
  33. postgresql12-libs x86_64 12.10-1PGDG.rhel8 pgdg12 400 k
  34. Transaction Summary
  35. =====================================================================================================================================================================================================
  36. Install 2 Packages
  37. Total download size: 2.1 M
  38. Installed size: 10 M
  39. Is this ok [y/N]: y
  40. Downloading Packages:
  41. (1/2): postgresql12-libs-12.10-1PGDG.rhel8.x86_64.rpm 50 kB/s | 400 kB 00:08
  42. (2/2): postgresql12-12.10-1PGDG.rhel8.x86_64.rpm 172 kB/s | 1.7 MB 00:09
  43. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  44. Total 213 kB/s | 2.1 MB 00:09
  45. warning: /var/cache/dnf/pgdg12-64e2194e85277659/packages/postgresql12-12.10-1PGDG.rhel8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
  46. PostgreSQL 12 for RHEL / Rocky 8 - x86_64 1.6 MB/s | 1.7 kB 00:00
  47. Importing GPG key 0x442DF0F8:
  48. Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
  49. Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
  50. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
  51. Is this ok [y/N]: y
  52. Key imported successfully
  53. Running transaction check
  54. Transaction check succeeded.
  55. Running transaction test
  56. Transaction test succeeded.
  57. Running transaction
  58. Preparing : 1/1
  59. Installing : postgresql12-libs-12.10-1PGDG.rhel8.x86_64 1/2
  60. Running scriptlet: postgresql12-libs-12.10-1PGDG.rhel8.x86_64 1/2
  61. Installing : postgresql12-12.10-1PGDG.rhel8.x86_64 2/2
  62. Running scriptlet: postgresql12-12.10-1PGDG.rhel8.x86_64 2/2
  63. Verifying : postgresql12-12.10-1PGDG.rhel8.x86_64 1/2
  64. Verifying : postgresql12-libs-12.10-1PGDG.rhel8.x86_64 2/2
  65. Installed products updated.
  66. Installed:
  67. postgresql12-12.10-1PGDG.rhel8.x86_64 postgresql12-libs-12.10-1PGDG.rhel8.x86_64
  68. Complete!

安装服务端

  1. [root@localhost ~]# dnf install postgresql12-server
  2. Last metadata expiration check: 0:05:33 ago on Tue 22 Mar 2022 02:10:45 PM CST.
  3. Dependencies resolved.
  4. =====================================================================================================================================================================================================
  5. Package Architecture Version Repository Size
  6. =====================================================================================================================================================================================================
  7. Installing:
  8. postgresql12-server x86_64 12.10-1PGDG.rhel8 pgdg12 5.2 M
  9. Transaction Summary
  10. =====================================================================================================================================================================================================
  11. Install 1 Package
  12. Total download size: 5.2 M
  13. Installed size: 21 M
  14. Is this ok [y/N]: y
  15. Downloading Packages:
  16. postgresql12-server-12.10-1PGDG.rhel8.x86_64.rpm 390 kB/s | 5.2 MB 00:13
  17. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  18. Total 390 kB/s | 5.2 MB 00:13
  19. Running transaction check
  20. Transaction check succeeded.
  21. Running transaction test
  22. Transaction test succeeded.
  23. Running transaction
  24. Preparing : 1/1
  25. Running scriptlet: postgresql12-server-12.10-1PGDG.rhel8.x86_64 1/1
  26. Installing : postgresql12-server-12.10-1PGDG.rhel8.x86_64 1/1
  27. Running scriptlet: postgresql12-server-12.10-1PGDG.rhel8.x86_64 1/1
  28. Verifying : postgresql12-server-12.10-1PGDG.rhel8.x86_64 1/1
  29. Installed products updated.
  30. Installed:
  31. postgresql12-server-12.10-1PGDG.rhel8.x86_64
  32. Complete!
  1. [root@localhost ~]# dnf install postgresql12-contrib
  2. Last metadata expiration check: 0:09:45 ago on Tue 22 Mar 2022 02:10:45 PM CST.
  3. Dependencies resolved.
  4. =====================================================================================================================================================================================================
  5. Package Architecture Version Repository Size
  6. =====================================================================================================================================================================================================
  7. Installing:
  8. postgresql12-contrib x86_64 12.10-1PGDG.rhel8 pgdg12 645 k
  9. Transaction Summary
  10. =====================================================================================================================================================================================================
  11. Install 1 Package
  12. Total download size: 645 k
  13. Installed size: 2.3 M
  14. Is this ok [y/N]: y
  15. Downloading Packages:
  16. postgresql12-contrib-12.10-1PGDG.rhel8.x86_64.rpm 84 kB/s | 645 kB 00:07
  17. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  18. Total 84 kB/s | 645 kB 00:07
  19. Running transaction check
  20. Transaction check succeeded.
  21. Running transaction test
  22. Transaction test succeeded.
  23. Running transaction
  24. Preparing : 1/1
  25. Installing : postgresql12-contrib-12.10-1PGDG.rhel8.x86_64 1/1
  26. Running scriptlet: postgresql12-contrib-12.10-1PGDG.rhel8.x86_64 1/1
  27. Verifying : postgresql12-contrib-12.10-1PGDG.rhel8.x86_64 1/1
  28. Installed products updated.
  29. Installed:
  30. postgresql12-contrib-12.10-1PGDG.rhel8.x86_64
  31. Complete!

注意:程序安装目录是”/usr/pgsql-12”,程序运行目录是”/var/run/postgresql”,程序运行用户和组是”postgres:postgres”,”postgres”用户和组安装时默认创建。

pgsql的配置

1 设置数据库默认的数据存储目录

数据库实例的默认存储目录是/var/lib/pgsql/12/data/,/var是一个系统目录,不适合存放大量的业务数据,因此要在初始化数据库实例之前创建一个存储目录

mkdir -p /data/pgsql12-data:因为创建了多级目录,所以需要-p

  1. [root@localhost /]# mkdir -p /data/pgsql12-data
  2. [root@localhost /]# ls
  3. bin boot data dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
  4. [root@localhost /]# cd data
  5. [root@localhost data]# ll
  6. total 4
  7. drwxr-xr-x. 2 root root 4096 Mar 22 14:27 pgsql12-data

设置数据存储目录的所有者用户和组为postgres:postgres,postgres用户和组在安装PostgreSQL12时已创建

  1. [root@localhost data]# chown postgres:postgres /data/pgsql12-data

修改postgreSQL12开机启动服务配置文件,设置为新的数据存储目录

[root@localhost data]# vim /usr/lib/systemd/system/postgresql-12.service <服务配置文件路径!>

将其中的enviroment变量注释掉,改为新的

file

2 初始化数据库实例

进入程序安装目录下的bin目录下,执行postgresql-12-setup initdb命令。

  1. [root@localhost data]# cd /usr/pgsql-12/bin
  2. [root@localhost bin]# ./postgresql-12-setup initdb
  3. Initializing database ... OK

3 启动数据库实例服务,并设置为开机自动启动

  1. [root@localhost bin]# systemctl enable postgresql-12.service
  2. Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-12.service /usr/lib/systemd/system/postgresql-12.service.
  3. [root@localhost bin]# systemctl start postgresql-12.service

4 设置数据库实例超级管理员账户postgres的口令

postgreSQL12安装完成后postgres的默认口令为空,为空时无法使用该用户登录数据库。

  1. [root@localhost bin]# passwd postgres
  2. Changing password for user postgres.
  3. New password: prs@2018
  4. Retype new password: prs@2018
  5. passwd: all authentication tokens updated successfully.
  1. [root@localhost bin]# su postgres
  2. bash-4.4$ psql
  3. psql (12.10)
  4. Type "help" for help.
  5. postgres=# alter user postgres with password 'xxxxx';
  6. ALTER ROLE
  7. postgres=# \q
  8. bash-4.4$ exit
  9. exit
  10. [root@localhost bin]#

5 设置数据库实例的远程访问策略

postgreSQL12安装完成后默认只允许本地访问

设置数据库实例访问策略,可以设置多个由主机类型、数据库、用户、IP地址组成的策略。

​ 在文件的”# IPv4 local connections”策略中追加一条“允许全部用户,通过全部网络地址访问全部数据库”的策略并保存,策略定义如 下:

  1. vim /data/pgsql12-data/pg_hba.conf "配置文件conf"
  2. image-20220507152653413

file

设置数据库实例的监听端口

监听地址:*默认是全部地址,默认是localhost ||监听端口:默认是5432

​ vim /data/pgsql12-data/postgresql.conf

file

设置防火墙端口

​ centOS8默认安装firewall防火墙,允许5432端口(PostgreSQL默认端口)访问服务器。

  1. [root@localhost bin]# firewall-cmd --zone=public --add-port=5432/tcp --permanent
  2. success
  3. [root@localhost bin]# firewall-cmd --reload
  4. success

重新启动数据库服务实例

  1. systemctl restart postgresql-12.service

数据库的运维和管理

数据库启动、停止、重启、查看状态、开机自启动、禁用开机自启动

  1. [root@localhost bin]# systemctl start postgresql-12.service #开启
  2. [root@localhost bin]# systemctl stop postgresql-12.service #停止
  3. [root@localhost bin]# systemctl restart postgresql-12.service #重启
  4. [root@localhost bin]# systemctl status postgresql-12.service #查看状态
  5. postgresql-12.service - PostgreSQL 12 database server
  6. Loaded: loaded (/usr/lib/systemd/system/postgresql-12.service; enabled; vendor preset: disabled)
  7. Active: active (running) since Tue 2022-03-22 15:02:49 CST; 7s ago
  8. Docs: https://www.postgresql.org/docs/12/static/
  9. Process: 41843 ExecStartPre=/usr/pgsql-12/bin/postgresql-12-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
  10. Main PID: 41849 (postmaster)
  11. Tasks: 8 (limit: 11432)
  12. Memory: 17.8M
  13. CGroup: /system.slice/postgresql-12.service
  14. ├─41849 /usr/pgsql-12/bin/postmaster -D /data/pgsql12-data/
  15. ├─41853 postgres: logger
  16. ├─41855 postgres: checkpointer
  17. ├─41856 postgres: background writer
  18. ├─41857 postgres: walwriter
  19. ├─41858 postgres: autovacuum launcher
  20. ├─41859 postgres: stats collector
  21. └─41860 postgres: logical replication launcher
  22. Mar 22 15:02:49 localhost.localdomain systemd[1]: Starting PostgreSQL 12 database server...
  23. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.320 CST [41849] LOG: starting PostgreSQL 12.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8>
  24. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.321 CST [41849] LOG: listening on IPv4 address "0.0.0.0", port 5432
  25. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.321 CST [41849] LOG: listening on IPv6 address "::", port 5432
  26. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.324 CST [41849] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
  27. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.328 CST [41849] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
  28. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.338 CST [41849] LOG: redirecting log output to logging collector process
  29. Mar 22 15:02:49 localhost.localdomain postmaster[41849]: 2022-03-22 15:02:49.338 CST [41849] HINT: Future log output will appear in directory "log".
  30. Mar 22 15:02:49 localhost.localdomain systemd[1]: Started PostgreSQL 12 database server.
  31. [root@localhost bin]# systemctl enable postgresql-12.service #开机自动开启

创建用户

  1. [root@localhost pgsql12-data]# su postgres
  2. bash-4.4$ psql
  3. psql (12.10)
  4. Type "help" for help.
  5. postgres=# CREATE DATABASE pvp_msf;
  6. CREATE DATABASE
  7. postgres=# CREATE DATABASE pvp_strike_db;
  8. CREATE DATABASE

离线安装需要的包

rpms包:

  1. postgresql12-contrib-12.10-1PGDG.rhel8.x86_64.rpm
  2. postgresql12-devel-12.10-1PGDG.rhel8.x86_64.rpm
  3. postgresql12-docs-12.10-1PGDG.rhel8.x86_64.rpm
  4. postgresql12-libs-12.10-1PGDG.rhel8.x86_64.rpm
  5. postgresql12-llvmjit-12.10-1PGDG.rhel8.x86_64.rpm
  6. postgresql12-plperl-12.10-1PGDG.rhel8.x86_64.rpm
  7. postgresql12-plpython-12.10-1PGDG.rhel8.x86_64.rpm
  8. postgresql12-plpython3-12.10-1PGDG.rhel8.x86_64.rpm
  9. postgresql12-pltcl-12.10-1PGDG.rhel8.x86_64.rpm
  10. postgresql12-server-12.10-1PGDG.rhel8.x86_64.rpm
  11. postgresql12-test-12.10-1PGDG.rhel8.x86_64.rpm

静态资源包:postgresql-12.10 -tar.gz

本文转自:https://www.cnblogs.com/ivanlee717/p/16242784.html

更多相关文章

  1. Android开发笔记之adb参数指南
  2. Android(安卓)ContentProvider的介绍
  3. Android(安卓)ListView 滚动条的设置详解及实例代码
  4. 在 Android(安卓)应用中使用数据库
  5. android sqlite数据库封装 实现crud
  6. Android/OPhone开发完全讲义
  7. Android中的四种启动方式
  8. android 4种存储方式
  9. Android开发笔记之adb参数指南

随机推荐

  1. Android TextView Marquee的应用实例详解
  2. Android keytool 生成证书MD5指纹
  3. Android 学习记录
  4. Android 应用指定浏览器开发实例
  5. android 圆环图形的实现
  6. Android视频方向为什么出现问题以及Andro
  7. Android 自定义标题栏(title栏)
  8. Android 中文API (66) —— BluetoothClass
  9. Android 音频播放
  10. Android -很全的android操作内容丰富