PostgreSQL 15
创始人
2024-11-13 18:09:12
0

一、安装前的准备

1、版本信息
操作系统CentOS 7.9.2009
PostgreSQL 版本PostgreSQL 15-15.7
2、下载安装包

RPM Chart - PostgreSQL YUM Repositoryicon-default.png?t=N7T8https://yum.postgresql.org/rpmchart/进入官网,找到相应版本

点击框选内容

依次进入下载页面,下载相应版本安装包

二、安装

1、上传安装包到服务器/opt/目录下
2、安装
rpm -ivh postgresql15-libs-15.7-1PGDG.rhel7.x86_64.rpm  rpm -ivh postgresql15-15.7-1PGDG.rhel7.x86_64.rpm  rpm -ivh postgresql15-server-15.7-1PGDG.rhel7.x86_64.rpm
3、修改配置
vi /usr/lib/systemd/system/postgresql-15.service # 修改存储目录 Environment=PGDATA=/opt/postgres/data/
4、创建目录并修改权限
mkdir -p /opt/postgres/data chown -R postgres: postgres chmod 700 data/
5、初始化数据库
/usr/pgsql-15/bin/postgresql-15-setup initdb Initializing database ... OK
6、启动服务并设置开机自启
[root@localhost postgres]# systemctl start postgresql-15.service  [root@localhost postgres]# systemctl status postgresql-15.service  ● postgresql-15.service - PostgreSQL 15 database server    Loaded: loaded (/usr/lib/systemd/system/postgresql-15.service; disabled; vendor preset: disabled)    Active: active (running) since Fri 2024-08-02 04:59:05 EDT; 7s ago      Docs: https://www.postgresql.org/docs/15/static/   Process: 48801 ExecStartPre=/usr/pgsql-15/bin/postgresql-15-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)  Main PID: 48806 (postmaster)    CGroup: /system.slice/postgresql-15.service            ├─48806 /usr/pgsql-15/bin/postmaster -D /opt/postgres/data/            ├─48808 postgres: logger             ├─48809 postgres: checkpointer             ├─48810 postgres: background writer             ├─48812 postgres: walwriter             ├─48813 postgres: autovacuum launcher             └─48814 postgres: logical replication launcher   Aug 02 04:59:05 localhost.localdomain systemd[1]: Starting PostgreSQL 15 database server... Aug 02 04:59:05 localhost.localdomain postmaster[48806]: 2024-08-02 04:59:05.058 EDT [48806] LOG:  redirecting log output to logging collector process Aug 02 04:59:05 localhost.localdomain postmaster[48806]: 2024-08-02 04:59:05.058 EDT [48806] HINT:  Future log output will appear in directory "log". Aug 02 04:59:05 localhost.localdomain systemd[1]: Started PostgreSQL 15 database server. [root@localhost postgres]#  [root@localhost postgres]#  [root@localhost postgres]# systemctl enable postgresql-15.service g Failed to execute operation: No such file or directory [root@localhost postgres]# systemctl enable postgresql-15.service  Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-15.service to /usr/lib/systemd/system/postgresql-15.service.
7、修改管理员密码
[root@localhost postgres]# su - postgres  -bash-4.2$ psql  psql (15.7) Type "help" for help.  postgres=# alter user postgres with password 'postgres'; ALTER ROLE
8、设置允许远程登陆
vi /opt/postgres/data/postgresql.conf # 修改下面行 listen_addresses = '*'  vi /opt/postgres/data/pg_hba.conf # 在最后添加下面行 host    all             all             0.0.0.0/0               md5  # 重启服务,进行远程连接测试

三、错误

[root@localhost opt]# rpm -ivh postgresql15-server-15.7-1PGDG.rhel7.x86_64.rpm  warning: postgresql15-server-15.7-1PGDG.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY error: Failed dependencies:         libicui18n.so.50()(64bit) is needed by postgresql15-server-15.7-1PGDG.rhel7.x86_64         libicuuc.so.50()(64bit) is needed by postgresql15-server-15.7-1PGDG.rhel7.x86_64         libzstd.so.1()(64bit) is needed by postgresql15-server-15.7-1PGDG.rhel7.x86_64         postgresql15(x86-64) = 15.7-1PGDG.rhel7 is needed by postgresql15-server-15.7-1PGDG.rhel7.x86_64  rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm yum -y install libzstd.x86_64

相关内容

热门资讯

绝活儿辅助!广西老友玩老是输怎... 绝活儿辅助!广西老友玩老是输怎么办(辅助挂)都是真的有辅助app(讲解有挂)在进入广西老友玩老是输怎...
法门辅助!福建13水插件(辅助... 法门辅助!福建13水插件(辅助挂)一贯是有辅助技巧(有挂技术)1、许多玩家不知道福建13水插件辅助怎...
办法辅助!潮友会app下载官方... 办法辅助!潮友会app下载官方辅助器(辅助挂)真是真的是有辅助app(有挂教程)该软件可以轻松地帮助...
妙招辅助!邯郸胡乐挂辅助(辅助... 妙招辅助!邯郸胡乐挂辅助(辅助挂)好像存在有辅助插件(有挂方略)1、上手简单,内置详细流程视频教学,...
教程书辅助!乐酷辅助(辅助挂)... 教程书辅助!乐酷辅助(辅助挂)其实存在有辅助脚本(有挂细节)乐酷辅助能透视中分为三种模型:乐酷辅助模...
学习辅助!决战卡五星辅助(辅助... 学习辅助!决战卡五星辅助(辅助挂)本来真的是有辅助软件(有人有挂)学习辅助!决战卡五星辅助(辅助挂)...
绝活辅助!边锋嘉兴麻将辅助器(... 绝活辅助!边锋嘉兴麻将辅助器(辅助挂)真是真的有辅助神器(新版有挂)1、边锋嘉兴麻将辅助器公共底牌简...
举措辅助!枫叶辅助器(辅助挂)... 举措辅助!枫叶辅助器(辅助挂)本来存在有辅助技巧(竟然有挂)1、下载好枫叶辅助器正确养号方法之后点击...
讲义辅助!点我达辅助(辅助挂)... 讲义辅助!点我达辅助(辅助挂)一直存在有辅助技巧(有人有挂)1、点我达辅助辅助器安装包、点我达辅助辅...
模块辅助!威信茶馆有挂的吗(辅... 模块辅助!威信茶馆有挂的吗(辅助挂)一直真的是有辅助脚本(揭秘有挂)1、玩家可以在威信茶馆有挂的吗线...