centos7-2003离线安装最新版postgresql

1.检查PostgreSQL 是否已经安装

rpm -qa|grep postgres
若已经安装,则使用rpm -e 命令卸载。

2.下载RPM包,下载其中3个RPM安装包就可以了:

https://yum.postgresql.org/rpmchart.php

  • postgresql15 PostgreSQL client programs and libraries
  • postgresql15-libs The shared libraries required for any PostgreSQL clients
  • postgresql15-server The programs needed to create and run a PostgreSQL server

3.安装

注意安装顺序
rpm -ivh postgresql15-libs-15.4-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql15-15.4-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql15-server-15.4-1PGDG.rhel7.x86_64.rpm
如果提示缺少libicu、libzstd包,那么先去下载安装
下载地址:http://www.rpmfind.net/linux/rpm2html/search.php
安装:
rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm
rpm -ivh libzstd-1.5.5-1.el7.x86_64.rpm

4.服务

查看服务
systemctl status postgresql-15
查看服务文件
cat /usr/lib/systemd/system/postgresql-15.service
Location of database directory
Environment=PGDATA=/var/lib/pgsql/13/data/
#程序目录
ExecStart=/usr/pgsql-13/bin/postmaster -D KaTeX parse error: Expected 'EOF', got '#' at position 42: …alhost postgre]#̲ su postgres ba… cd /usr/pgsql-15/bin/
bash-4.2$ ./initdb -D /var/lib/pgsql/15/data/
bash-4.2$ exit
exit
启动服务
[root@localhost postgre]# systemctl enable postgresql-15 && systemctl restart postgresql-15
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-15.service to /usr/lib/systemd/system/postgresql-15.service.
修改密码
[root@localhost postgre]# su postgres
bash-4.2$ psql -U postgres
postgres=# ALTER USER postgres with encrypted password ‘Aa@123456’;
配置远程连接
##想对所有IP开放,则将localhost改为*即可
vi /var/lib/pgsql/15/data/postgresql.conf
systemctl restart postgresql-15.service

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值