PostgreSQL-安装-win10、win11安装pgsql16.1和timescaledb2.13.0(绿色免安装版本)

发布于:2025-06-10 ⋅ 阅读:(18) ⋅ 点赞:(0)

1. 所属安装包

postgresql-16.1-1-windows-x64-lite.zip

        联系我获取下载地址

timescaledb-postgresql-16-windows-amd64-V2.13.0.zip (具体来源见下文)

https://github.com/timescale/timescaledb/releases/download/2.13.0/timescaledb-postgresql-16-windows-amd64.zip

第三方代理:https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.13.0/timescaledb-postgresql-16-windows-amd64.zip

部分系统环境可能还要求安装 OpenSSL 3.x.x

2. 安装postgresql-16.1-1-windows-x64-lite.zip

解压

0

文件说明:Make Cluster.bat 用于db文件夹初始化。可以不执行,默认data文件夹。

在当前文件夹的上一级设置权限,同时增加Evernone的权限(win11可能必须操作)

执行安装服务

修改Service - Maker.bat脚本,截图部分删除

0

用管理员打开cmd,执行Service - Maker.bat即可,会提示输入自定义的pgsql服务名称。

如果提示ip没有权限,是因为端口有占用,可以去data/postgresql.conf修改默认的5432端口

0

如果出现缺少dll

0

就安装 https://download.visualstudio.microsoft.com/download/pr/2c6b06c4-dc6a-4496-b769-b0d311cf515d/463F736D5925566EDC0E8F7D8E70C0A1FC95ADF44AFA5D5390B979F5A35934CC/VC_redist.x64.exe

https://code.jiangjiesheng.cn/attachment/cdn/tools/dev/databases/PgSQL16.1-green/VC_redist.x64.zip

3. 安装timescaledb-postgresql-16-windows-amd64-V2.13.0.zip

官方相关教程:

Timescale Documentation | Install TimescaleDB on Windows

但是不能直接使用使用其他的timescaledb的包(默认是最新版的,dll文件会不兼容,导致出现找不到dll文件的报错)

而是从 Releases · timescale/timescaledb · GitHub

每一页面搜索关键词“PostgreSQL 16”

找到 Full PostgreSQL 16 support for all existing features,即 2.13.0 (2023-11-28) 版本

https://github.com/timescale/timescaledb/releases/download/2.13.0/timescaledb-postgresql-16-windows-amd64.zip

第三方代理:https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.13.0/timescaledb-postgresql-16-windows-amd64.zip

更多版本的下载地址,可以自己尝试拼接:

https://github.com/timescale/timescaledb/releases/download/2.13.0/timescaledb-postgresql-16-windows-amd64.zip

https://github.com/timescale/timescaledb/releases/download/2.13.1/timescaledb-postgresql-16-windows-amd64.zip

https://github.com/timescale/timescaledb/releases/download/2.14.0/timescaledb-postgresql-16-windows-amd64.zip

https://github.com/timescale/timescaledb/releases/download/2.14.1/timescaledb-postgresql-16-windows-amd64.zip

https://github.com/timescale/timescaledb/releases/download/2.14.2/timescaledb-postgresql-16-windows-amd64.zip

https://github.com/timescale/timescaledb/releases/download/2.15.0/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.14.2/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.14.3/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.15.0/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.15.1/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.15.2/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.15.4/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.16.0/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.16.1/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.16.3/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.17.0/timescaledb-postgresql-16-windows-amd64.zip

https://ghfast.top/https://github.com/timescale/timescaledb/releases/download/2.17.1/timescaledb-postgresql-16-windows-amd64.zip

设置环境变量,必须

将上面postgresql-16.1-1-windows-x64-lite下的bin文件夹,添加到系统环境变量,不需要重启电脑。

先停用服务

进入系统 服务 ,停用pgsql服务

解压timescaledb-postgresql-16-windows-amd64.zip

右击setup.exe,管理员启动。

其中一步要输入postgresql.conf配置路径,示例:C:\Users\LP_T_24\Desktop\postgresql-16.1-1-windows-x64-lite\pgsql\data\postgresql.conf

最后回车关闭安装窗口

0

修改pgsql关键配置

data/postgresql.conf

shared_preload_libraries = 'timescaledb'

data/pg_hba.conf

将IPv4 的127.0.0.1/32 改成 0.0.0.0/0

进入系统 服务,重启pgsql服务

4. 开启时序数据库扩展并测试验证

SELECT * FROM pg_extension WHERE extname = 'timescaledb';

CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

CREATE TABLE test_conditions (
  time        TIMESTAMPTZ       NOT NULL,
  location    TEXT              NOT NULL,
  temperature DOUBLE PRECISION  NULL,
  humidity    DOUBLE PRECISION  NULL
);

INSERT INTO test_conditions (time, location, temperature, humidity) VALUES ('2025-03-18 17:39:11+08', '1', '2', '3');
INSERT INTO test_conditions (time, location, temperature, humidity) VALUES ('2025-03-19 17:39:11+08', '1', '2', '3');
INSERT INTO test_conditions (time, location, temperature, humidity) VALUES ('2025-03-20 17:39:11+08', '1', '2', '3');

SELECT * from test_conditions;

-- 删除超表,先备份数据 DROP TABLE test_conditions CASCADE;
select create_hypertable('test_conditions', 'time', chunk_time_interval=> interval '1 seconds', associated_table_prefix=>'_test_conditions', migrate_data => true);

-- 执行删除,不同的版本,入参顺序不同
select drop_chunks(interval '5 seconds', 'test_conditions');
select drop_chunks('test_conditions',interval '5 seconds');