CentOS 7离线安装Postgresql15.2+Timescaledb

rpm离线 方式安装(需提前下载所需包:https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-7.12-x86_64/)

libicu  可在此包中查找下载 http://mirror.centos.org/centos/7/os/x86_64/Packages/

系统版本:CentOS Linux release 7.5.1804 (Core)

本次案例是Postgresql15.2 +  timescaledb2.10.0  ,其他版本可自行下载

需要的包如下:

        rpm -ivh libzstd-1.5.2-1.el7.x86_64.rpm

        rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm 【如能不能下载文件安装,可执行 yum -y install libicu】

        rpm -ivh postgresql15-libs-15.2-1PGDG.rhel7.x86_64.rpm

        rpm -ivh postgresql15-15.2-1PGDG.rhel7.x86_64.rpm  【安装此步骤可能需要libicu

        rpm -ivh postgresql15-server-15.2-1PGDG.rhel7.x86_64.rpm

        rpm -ivh timescaledb_15-2.10.0-1.rhel7.x86_64.rpm

依次执行完上述安装文件。

初始数据库【进入/usr/pgsql-15/bin/目录 并执行:postgresql-15-setup initdb】

        [root@VMTest ~]# postgresql-15-setup initdb

        Initializing database ... OK

启动服务

systemctl enable postgresql-15  -- 设置为开机自启动

systemctl start postgresql-15

systemctl status postgresql-15  -- 查看服务状态

systemctl restart postgresql-15  -- 重启

进入 /var/lib/pgsql/15/data/ 目录,更改pg_hba.conf 配置

在IP4 下增加

host    all            all            0.0.0.0/0            scram-sha-256

更改postgresql.conf 配置,开启如下配置

listen_addresses = '*'

port = 5432

shared_preload_libraries = 'timescaledb'

更改完配置后重启

systemctl restart postgresql-15  -- 重启


开放端口

firewall-cmd --permanent --add-port=5432/tcp

firewall-cmd --reload

更改密码:

[root@localhost bin]# su - postgres

Last login: Thu May 16 21:24:53 EDT 2024 on pts/0

-bash-4.2$ psql

psql (15.2)

Type "help" for help.

postgres=# ALTER USER postgres WITH PASSWORD '123456'; 

重启服务

创建一个数据库 ,然后增加扩展

列出所有数据库:

\l 或 \list 

create database testdb;

\c testdb;

CREATE EXTENSION IF NOT EXISTS timescaledb;

出现下图代表扩展成功。

其他

指定数据库初始位置可参考

https://blog.csdn.net/ScienceRui/article/details/119543088 

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容