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/

系統(tǒng)版本: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 【如能不能下載文件安裝,可執(zhí)行 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

依次執(zhí)行完上述安裝文件。

初始數(shù)據(jù)庫【進入/usr/pgsql-15/bin/目錄 并執(zhí)行:postgresql-15-setup initdb】

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

? ? ? ? Initializing database ... OK

啟動服務(wù)

systemctl enable postgresql-15? -- 設(shè)置為開機自啟動

systemctl start postgresql-15

systemctl status postgresql-15? -- 查看服務(wù)狀態(tài)

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';?

重啟服務(wù)

創(chuàng)建一個數(shù)據(jù)庫 ,然后增加擴展

列出所有數(shù)據(jù)庫:

\l 或 \list?

create database testdb;

\c testdb;

CREATE EXTENSION IF NOT EXISTS timescaledb;

出現(xiàn)下圖代表擴展成功。

其他

指定數(shù)據(jù)庫初始位置可參考

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容