下载链接 PostgreSQL PGDG 14 Updates RPMs
依次下载下面三种文件
libicu
依赖rpm -qa | grep libicu
[root@localhost ~]# rpm -qa | grep libicu
libicu-50.2-4.el7_7.x86_64
没有的话下载安装
如果你想安装 libicu,可以使用以下命令:
yum install libicu
下载地址 RPM resource libicu
rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm
scp -r C:\Users\xx.xx\Downloads\postgresql14-libs-14.10-1PGDG.rhel7.x86_64.rpm root@192.168.182.131:/usr/local/xx
scp -r C:\Users\xx.xx\Downloads\postgresql14-14.10-1PGDG.rhel7.x86_64.rpm root@192.168.182.131:/usr/local/xx
scp -r C:\Users\xx.xx\Downloads\postgresql14-server-14.10-1PGDG.rhel7.x86_64.rpm root@192.168.182.131:/usr/local/xx
rpm -ivh postgresql14-libs-14.10-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql14-14.10-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql14-server-14.10-1PGDG.rhel7.x86_64.rpm
[root@localhost soft_resource]# rpm -ivh postgresql14-libs-14.10-1PGDG.rhel7.x86_64.rpm
警告:postgresql14-libs-14.10-1PGDG.rhel7.x86_64.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID 442df0f8: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:postgresql14-libs-14.10-1PGDG.rhe################################# [100%]
[root@localhost soft_resource]# rpm -ivh postgresql14-14.10-1PGDG.rhel7.x86_64.rpm
警告:postgresql14-14.10-1PGDG.rhel7.x86_64.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID 442df0f8: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:postgresql14-14.10-1PGDG.rhel7 ################################# [100%]
[root@localhost soft_resource]# rpm -ivh postgresql14-server-14.10-1PGDG.rhel7.x86_64.rpm
警告:postgresql14-server-14.10-1PGDG.rhel7.x86_64.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID 442df0f8: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:postgresql14-server-14.10-1PGDG.r################################# [100%]
/usr/pgsql-14/bin/postgresql-14-setup initdb
[root@localhost usr]# /usr/pgsql-14/bin/postgresql-14-setup initdb
Initializing database ... OK
vim /var/lib/pgsql/14/data/postgresql.conf
listen_addresses = '*' # 允许外部连接
port = 5432 # 端口号
vim /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
firewall-cmd --zone=public --add-port=5432/tcp --permanent
firewall-cmd --reload #修改后需要重新加载防火墙生效
# 显示success表示成功
# –zone=public表示作用域为公共的
# –add-port=3306/tcp添加tcp协议的端口端口号为3306
# –permanent永久生效,如果没有此参数,则只能维持当前 服 务生命周期内,重新启动后失效;
systemctl reload postgresql-14
systemctl restart postgresql-14
systemctl start postgresql-14
systemctl stop postgresql-14
test
用户[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 test password 'test';
CREATE ROLE
postgres=# ALTER ROLE test SUPERUSER;
ALTER ROLE