Install PostgreSQL 14 offline on CentOS 7

Here I have organized a full set of required program installation packages, and mixed resource points. If you really don’t have points, go ahead and download it yourself according to the steps I wrote.
PG14 offline program installation package and a full set of dependent packages download

1. Download the offline installation package


Download linkPostgreSQL PGDG 14 Updates RPMs

insert image description here

Go to download in turn

insert image description here

2. Download dependent packages


An error was reported during installation, missing libicudependencies

[root@server149058 postgresql]# rpm -ivh postgresql14-14.5-1PGDG.rhel7.x86_64.rpm 
warning: postgresql14-14.5-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
error: Failed dependencies:
        libicu is needed by postgresql14-14.5-1PGDG.rhel7.x86_64

Download link RPM resource libicu

insert image description here

3. Install the package


install in order

rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm 

rpm -ivh postgresql14-libs-14.5-1PGDG.rhel7.x86_64.rpm 
rpm -ivh postgresql14-14.5-1PGDG.rhel7.x86_64.rpm 
rpm -ivh postgresql14-server-14.5-1PGDG.rhel7.x86_64.rpm 

4. Post-installation operations


4.1 Initialize the database

[root@server149058 postgresql]# /usr/pgsql-14/bin/postgresql-14-setup initdb
Initializing database ... OK

4.2 Modify the configuration file

[root@server149058 postgresql]# vi /var/lib/pgsql/14/data/postgresql.conf
listen_addresses = '*'  # 允许外部连接
port = 5432             # 端口号

4.3 Open and allow access to ip

[root@server149058 data]# vi /var/lib/pgsql/14/data/pg_hba.conf
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256
# 添加下面这行,允许所有 ip 访问
host    all             all             0.0.0.0/0               md5

Allow firewall ports

[root@server149058 data]# firewall-cmd --permanent --add-port 5432/tcp
[root@server149058 data]# firewall-cmd --reload

4.4 Restart the service

[root@server149058 ~]# systemctl reload postgresql-14
[root@server149058 ~]# systemctl restart postgresql-14

4.5 Configure users

create testuseruser

[root@server149058 ~]# su postgres
bash-4.2$ psql
could not change directory to "/root": Permission denied
psql (14.5)
Type "help" for help.

postgres=# create user testuser password 'TestMyPass';
CREATE ROLE

Grant supervising authority

postgres=# ALTER ROLE testuser SUPERUSER;
ALTER ROLE

4.6 Client login

insert image description here

connection succeeded.

Guess you like

Origin blog.csdn.net/qq12547345/article/details/128390517