Install self-hosted TimescaleDB
Install TimescaleDB on Linux, macOS, Windows, Docker, Kubernetes, or from source
TimescaleDB is an open-source PostgreSQL extension that powers Tiger Cloud. Designed for running real-time analytics on time-series data, it supercharges ingest, query, storage, and analytics performance.
The following instructions are for development and testing installations. For a production environment, we strongly recommend that you implement the following, many of which you can achieve using PostgreSQL tooling:
- Incremental backup and database snapshots, with efficient point-in-time recovery.
- High availability replication, ideally with nodes across multiple availability zones.
- Automatic failure detection with fast restarts, for both non-replicated and replicated deployments.
- Asynchronous replicas for scaling reads when needed.
- Connection poolers for scaling client connections.
- Zero-down-time minor version and extension upgrades.
- Forking workflows for major version upgrades and other feature testing.
- Monitoring and observability.
Install TimescaleDB based on your distribution.
If you have previously installed PostgreSQL, you may encounter errors following these install instructions. Best practice is to fully remove any existing PostgreSQL installations before you begin. To keep your current PostgreSQL installation, install from source.
- Install the latest PostgreSQL packages
Terminal window sudo apt install gnupg postgresql-common apt-transport-https lsb-release wget - Run the PostgreSQL package setup script
Terminal window sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh - Add the TimescaleDB package
Terminal window echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.list - Install the TimescaleDB GPG key
Terminal window wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg - Update your local repository list
Terminal window sudo apt update - Install TimescaleDB
Terminal window sudo apt install timescaledb-2-postgresql-18 postgresql-client-18To install a specific TimescaleDB release, set the version. For example:
sudo apt-get install timescaledb-2-postgresql-14='2.6.0*' timescaledb-2-loader-postgresql-14='2.6.0*'Older versions of TimescaleDB may not support all the OS versions listed on this page.
- Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tuneBy default, this script is included with the
timescaledb-toolspackage when you install TimescaleDB. Use the prompts to tune your development or production environment. For more information on manual configuration, see Configuration. If you have an issue, runsudo apt install timescaledb-tools. - Restart PostgreSQL
Terminal window sudo systemctl restart postgresql - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
- Install the latest PostgreSQL packages
Terminal window sudo apt install gnupg postgresql-common apt-transport-https lsb-release wget - Run the PostgreSQL package setup script
Terminal window sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh - Add the TimescaleDB package
Terminal window echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.list - Install the TimescaleDB GPG key
Terminal window wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpgFor Ubuntu 21.10 and earlier use the following command:
Terminal window wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - - Update your local repository list
Terminal window sudo apt update - Install TimescaleDB
Terminal window sudo apt install timescaledb-2-postgresql-18 postgresql-client-18To install a specific TimescaleDB release, set the version. For example:
sudo apt-get install timescaledb-2-postgresql-14='2.6.0*' timescaledb-2-loader-postgresql-14='2.6.0*'Older versions of TimescaleDB may not support all the OS versions listed on this page.
- Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tuneBy default, this script is included with the
timescaledb-toolspackage when you install TimescaleDB. Use the prompts to tune your development or production environment. For more information on manual configuration, see Configuration. If you have an issue, runsudo apt install timescaledb-tools. - Restart PostgreSQL
Terminal window sudo systemctl restart postgresql - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
- Install the latest PostgreSQL packages
Terminal window sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm - Add the TimescaleDB repository
Terminal window sudo tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL[timescale_timescaledb]name=timescale_timescaledbbaseurl=https://packagecloud.io/timescale/timescaledb/el/$(rpm -E %{rhel})/\$basearchrepo_gpgcheck=1gpgcheck=0enabled=1gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkeysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crtmetadata_expire=300EOL - Update your local repository list
Terminal window sudo yum update - Install TimescaleDB
To avoid errors, do not install TimescaleDB Apache 2 Edition and TimescaleDB Community Edition at the same time.
Terminal window sudo yum install timescaledb-2-postgresql-18 postgresql18NoteOn Red Hat Enterprise Linux 8 and later, disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql - Initialize the PostgreSQL instance
Terminal window sudo /usr/pgsql-18/bin/postgresql-18-setup initdb - Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tune --pg-config=/usr/pgsql-18/bin/pg_configThis script is included with the
timescaledb-toolspackage when you install TimescaleDB. For more information, see configuration. - Enable and start PostgreSQL
Terminal window sudo systemctl enable postgresql-18sudo systemctl start postgresql-18 - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are now in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
- Install the latest PostgreSQL packages
Terminal window sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/F-$(rpm -E %{fedora})-x86_64/pgdg-fedora-repo-latest.noarch.rpm - Add the TimescaleDB repository
Terminal window sudo tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL[timescale_timescaledb]name=timescale_timescaledbbaseurl=https://packagecloud.io/timescale/timescaledb/el/9/\$basearchrepo_gpgcheck=1gpgcheck=0enabled=1gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkeysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crtmetadata_expire=300EOL - Update your local repository list
Terminal window sudo yum update - Install TimescaleDB
To avoid errors, do not install TimescaleDB Apache 2 Edition and TimescaleDB Community Edition at the same time.
Terminal window sudo yum install timescaledb-2-postgresql-18 postgresql18NoteOn Red Hat Enterprise Linux 8 and later, disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql - Initialize the PostgreSQL instance
Terminal window sudo /usr/pgsql-18/bin/postgresql-18-setup initdb - Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tune --pg-config=/usr/pgsql-18/bin/pg_configThis script is included with the
timescaledb-toolspackage when you install TimescaleDB. For more information, see configuration. - Enable and start PostgreSQL
Terminal window sudo systemctl enable postgresql-18sudo systemctl start postgresql-18 - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are now in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
- Update your local repository list
Terminal window sudo dnf update -ysudo dnf install -y epel-release - Install the latest PostgreSQL packages
Terminal window sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm - Add the TimescaleDB repository
Terminal window sudo tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL[timescale_timescaledb]name=timescale_timescaledbbaseurl=https://packagecloud.io/timescale/timescaledb/el/9/\$basearchrepo_gpgcheck=1gpgcheck=0enabled=1gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkeysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crtmetadata_expire=300EOL - Disable the built-in {C.PG} module
This is for Rocky Linux 9 only.
Terminal window sudo dnf module disable postgresql -y - Install TimescaleDB
To avoid errors, do not install TimescaleDB Apache 2 Edition and TimescaleDB Community Edition at the same time.
Terminal window sudo dnf install -y postgresql18-server postgresql18-contrib timescaledb-2-postgresql-18 - Initialize the PostgreSQL instance
Terminal window sudo /usr/pgsql-18/bin/postgresql-18-setup initdb - Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tune --pg-config=/usr/pgsql-18/bin/pg_configThis script is included with the
timescaledb-toolspackage when you install TimescaleDB. For more information, see configuration. - Enable and start PostgreSQL
Terminal window sudo systemctl enable postgresql-18sudo systemctl start postgresql-18 - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are now in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
ArchLinux packages are built by the community.
- Install the latest PostgreSQL and TimescaleDB packages
Terminal window sudo pacman -Syu timescaledb timescaledb-tune postgresql-libs - Initalize your PostgreSQL instance
Terminal window sudo -u postgres initdb --locale=en_US.UTF-8 --encoding=UTF8 -D /var/lib/postgres/data --data-checksums - Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tuneThis script is included with the
timescaledb-toolspackage when you install TimescaleDB. For more information, see configuration. - Enable and start PostgreSQL
Terminal window sudo systemctl enable postgresql.servicesudo systemctl start postgresql.service - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
Add the TimescaleDB extension to your database
Section titled “Add the TimescaleDB extension to your database”For improved performance, you enable TimescaleDB on each database on your self-hosted PostgreSQL instance. This section shows you how to enable TimescaleDB for a new database in PostgreSQL using psql from the command line.
- Connect to a database on your PostgreSQL instance
In PostgreSQL, the default user and database are both
postgres. To use a different database, set<database-name>to the name of that database:Terminal window psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>" - Add TimescaleDB to the databaseCREATE EXTENSION IF NOT EXISTS timescaledb;
- Check that TimescaleDB is installed\dx
You see the list of installed extensions:
List of installed extensionsName | Version | Default version | Schema | Description-------------+---------+-----------------+------------+---------------------------------------------------------------------------------------plpgsql | 1.0 | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.24.0 | 2.24.0 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)(2 rows)Press
\qto exit the list of extensions.
You can install TimescaleDB with MacOS and Homebrew.
If you have already installed PostgreSQL using a method other than Homebrew or MacPorts, you may encounter errors following these install instructions. Best practice is to fully remove any existing PostgreSQL installations before you begin. To keep your current PostgreSQL installation, install from source.
- Install Homebrew
If homebrew is not already installed on your machine, run the following command:
Terminal window /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"For more information about Homebrew, including installation instructions, see the Homebrew documentation.
- Install and start PostgreSQL
Terminal window brew install postgresql@17brew cleanup --prune-prefixbrew services start postgresql@17 - Add PostgreSQL to your path
Terminal window echo 'export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"' >> ~/.zshrcsource ~/.zshrc - Add the TimescaleDB Homebrew tap
Terminal window brew tap timescale/tap - Install TimescaleDB
Terminal window brew install timescaledb - Configure your database
Terminal window timescaledb-tune --quiet --yes - Run the setup script to complete installation
Terminal window $(brew --prefix)/Cellar/timescaledb/$(brew list --versions timescaledb | awk '{print $2}')/bin/timescaledb_move.shThis command automatically locates the correct version and runs the setup script.
- Start the PostgreSQL service
Terminal window brew services restart postgresql@17 - Verify PostgreSQL is running
Terminal window brew services list | grep postgresqlYou should see
postgresql@17with statusstarted. - Connect to PostgreSQL
Terminal window psql postgresYou are now in the psql shell.
- Set the password for your database user
(optional but recommended)
Terminal window \passwordWhen you have set the password, type
\qto exit psql.
- Install MacPorts by downloading and running the package installer.
For more information about MacPorts, including installation instructions, see the MacPorts documentation.
- Install TimescaleDB and psql:
Terminal window sudo port install timescaledb libpqxxTo view the files installed, run:
Terminal window port contents timescaledb libpqxxTipsMacPorts does not install the
timescaledb-toolspackage or run thetimescaledb-tunescript. For more information about tuning your database, see the TimescaleDB tuning tool. - Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are in the psql shell.
- Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
Add the TimescaleDB extension to your database
Section titled “Add the TimescaleDB extension to your database”For improved performance, you enable TimescaleDB on each database on your self-hosted PostgreSQL instance. This section shows you how to enable TimescaleDB for a new database in PostgreSQL using psql from the command line.
- Connect to a database on your PostgreSQL instance
In PostgreSQL, the default user and database are both
postgres. To use a different database, set<database-name>to the name of that database:Terminal window psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>" - Add TimescaleDB to the databaseCREATE EXTENSION IF NOT EXISTS timescaledb;
- Check that TimescaleDB is installed\dx
You see the list of installed extensions:
List of installed extensionsName | Version | Default version | Schema | Description-------------+---------+-----------------+------------+---------------------------------------------------------------------------------------plpgsql | 1.0 | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.24.0 | 2.24.0 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)(2 rows)Press
\qto exit the list of extensions.
To install TimescaleDB on Windows, you need:
- OpenSSL v3.x. For TimescaleDB v2.14.1 only, install OpenSSL v1.1.1.
- Visual C++ Redistributable for Visual Studio 2015
If you have previously installed PostgreSQL, you may encounter errors following these install instructions. Best practice is to fully remove any existing PostgreSQL installations before you begin. To keep your current PostgreSQL installation, install from source.
- Install the latest version of PostgreSQL and psql
-
Download PostgreSQL, then run the installer.
-
In the
Select Componentsdialog, checkCommand Line Tools, along with any other components you want to install, and clickNext. -
Complete the installation wizard.
-
-
Check that you can run
pg_config.If you cannot run
pg_configfrom the command line, in the Windows Search tool, entersystem environment variables. The path should beC:\Program Files\PostgreSQL\<version>\bin.
-
- Install TimescaleDB
-
Unzip the installer to
<install_dir>, that is, your selected directory.Best practice is to use the latest version.
-
In
<install_dir>\timescaledb, right-clicksetup.exe, then chooseRun as Administrator. -
Complete the installation wizard.
During installation, the wizard will prompt you to run the
timescaledb-tunescript to optimize your PostgreSQL configuration. It is recommended to accept this option. For more information, see configuration.If you see an error like
could not load library "C:/Program Files/PostgreSQL/17/lib/timescaledb-2.17.2.dll": The specified module could not be found., use Dependencies to ensure that your system can find the compatible DLLs for this release of TimescaleDB.
-
- Restart the PostgreSQL service
Terminal window Restart-Service postgresql-x64-18Replace
18with your PostgreSQL version if different.
Add the TimescaleDB extension to your database
Section titled “Add the TimescaleDB extension to your database”For improved performance, you enable TimescaleDB on each database on your self-hosted PostgreSQL instance. This section shows you how to enable TimescaleDB for a new database in PostgreSQL using psql from the command line.
- Connect to a database on your PostgreSQL instance
In PostgreSQL, the default user and database are both
postgres. To use a different database, set<database-name>to the name of that database:Terminal window psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>" - Add TimescaleDB to the databaseCREATE EXTENSION IF NOT EXISTS timescaledb;
- Check that TimescaleDB is installed\dx
You see the list of installed extensions:
List of installed extensionsName | Version | Default version | Schema | Description-------------+---------+-----------------+------------+---------------------------------------------------------------------------------------plpgsql | 1.0 | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.24.0 | 2.24.0 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)(2 rows)Press
\qto exit the list of extensions.
Windows downloads
Section titled “Windows downloads”The latest TimescaleDB releases for PostgreSQL:
For release information, see the GitHub releases page.
You can install a TimescaleDB instance on any local system from a pre-built Docker container.
To install TimescaleDB from Docker, you need:
- Run the TimescaleDB Docker image
The TimescaleDB HA Docker image offers the most complete TimescaleDB experience. It uses Ubuntu, includes TimescaleDB Toolkit, and support for PostGIS and Patroni.
To install the latest release based on PostgreSQL 18:
docker pull timescale/timescaledb-ha:pg18TimescaleDB is pre-created in the default PostgreSQL database and is added by default to any new database you create in this image.
- Run the container
Replace
</a/local/data/folder>with the path to the folder you want to keep your data in the following command.docker run -d --name timescaledb -p 5432:5432 -v </a/local/data/folder>:/pgdata -e PGDATA=/pgdata -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg18If you are running multiple container instances, change the port each Docker instance runs on.
NoteIf you have a local PostgreSQL instance already running on port 5432, change the Docker port mapping to avoid conflicts. For example, use
-p 5433:5432and adjust the connection string accordingly.On UNIX-based systems, Docker modifies Linux IP tables to bind the container. If your system uses Linux Uncomplicated Firewall (UFW), Docker may override your UFW port binding settings. To prevent this, add
DOCKER_OPTS="--iptables=false"to/etc/default/docker. - Connect to a database on your PostgreSQL instance
The default user and database are both
postgres. You set the password inPOSTGRES_PASSWORDin the previous step. The default command to connect to PostgreSQL is:Terminal window psql -d "postgres://postgres:password@127.0.0.1:5432/postgres"If you changed the port mapping in step 2 (e.g., to 5433), update the port in the connection string accordingly.
- Check that TimescaleDB is installed\dx
You see the list of installed extensions:
Name | Version | Default version | Schema | Description---------------------+---------+-----------------+------------+---------------------------------------------------------------------------------------plpgsql | 1.0 | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.24.0 | 2.24.0 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)timescaledb_toolkit | 1.22.0 | 1.22.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities(3 rows)Press
qto exit the list of extensions.
More Docker options
If you want to access the container from the host but avoid exposing it to the
outside world, you can bind to 127.0.0.1 instead of the public interface, using this command:
docker run -d --name timescaledb -p 127.0.0.1:5432:5432 \-v </a/local/data/folder>:/pgdata -e PGDATA=/pgdata -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg18If you don’t want to install psql and other PostgreSQL client tools locally,
or if you are using a Microsoft Windows host system, you can connect using the
version of psql that is bundled within the container with this command:
docker exec -it timescaledb psql -U postgresWhen you install TimescaleDB using a Docker container, the PostgreSQL settings
are inherited from the container. In most cases, you do not need to adjust them.
However, if you need to change a setting, you can add -c setting=value to your
Docker run command. For more information, see the
Docker documentation.
The link provided in these instructions is for the latest version of TimescaleDB on PostgreSQL 18. To find other Docker tags you can use, see the Dockerhub repository.
View logs in Docker
If you have TimescaleDB installed in a Docker container, you can view your logs
using Docker, instead of looking in /var/lib/logs or /var/logs. For more
information, see the Docker documentation on logs.
- Run the TimescaleDB Docker image
The light-weight TimescaleDB Docker image uses Alpine and does not contain TimescaleDB Toolkit or support for PostGIS and Patroni.
To install the latest release based on PostgreSQL 18:
docker pull timescale/timescaledb:latest-pg18TimescaleDB is pre-created in the default PostgreSQL database and added by default to any new database you create in this image.
- Run the containerdocker run -v </a/local/data/folder>:/pgdata -e PGDATA=/pgdata \-d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg18
If you are running multiple container instances, change the port each Docker instance runs on.
NoteIf you have a local PostgreSQL instance already running on port 5432, change the Docker port mapping to avoid conflicts. For example, use
-p 5433:5432and adjust the connection string accordingly.On UNIX-based systems, Docker modifies Linux IP tables to bind the container. If your system uses Linux Uncomplicated Firewall (UFW), Docker may override your UFW port binding settings. To prevent this, add
DOCKER_OPTS="--iptables=false"to/etc/default/docker. - Connect to a database on your PostgreSQL instance
The default user and database are both
postgres. You set the password inPOSTGRES_PASSWORDin the previous step. The default command to connect to PostgreSQL in this image is:Terminal window psql -d "postgres://postgres:password@127.0.0.1:5432/postgres"If you changed the port mapping in step 2 (e.g., to 5433), update the port in the connection string accordingly.
- Check that TimescaleDB is installed\dx
You see the list of installed extensions:
List of installed extensionshName | Version | Default version | Schema | Description-------------+---------+-----------------+------------+---------------------------------------------------------------------------------------plpgsql | 1.0 | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.24.0 | 2.24.0 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)Press
qto exit the list of extensions.More Docker options
If you want to access the container from the host but avoid exposing it to the outside world, you can bind to
127.0.0.1instead of the public interface, using this command:Terminal window docker run -v </a/local/data/folder>:/pgdata -e PGDATA=/pgdata \-d --name timescaledb -p 127.0.0.1:5432:5432 \-e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg18If you don’t want to install
psqland other PostgreSQL client tools locally, or if you are using a Microsoft Windows host system, you can connect using the version ofpsqlthat is bundled within the container with this command:Terminal window docker exec -it timescaledb psql -U postgresExisting containers can be stopped using
docker stopand started again withdocker startwhile retaining their volumes and data. When you create a new container using thedocker runcommand, by default you also create a new data volume. When you remove a Docker container withdocker rm, the data volume persists on disk until you explicitly delete it. You can use thedocker volume lscommand to list existing docker volumes. If you want to store the data from your Docker container in a host directory, or you want to run the Docker image on top of an existing data directory, you can specify the directory to mount a data volume using the-vflag:Terminal window docker run -d --name timescaledb -p 5432:5432 \-v </your/data/dir>:/pgdata -e PGDATA=/pgdata \-e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg18When you install TimescaleDB using a Docker container, the PostgreSQL settings are inherited from the container. In most cases, you do not need to adjust them. However, if you need to change a setting, you can add
-c setting=valueto your Dockerruncommand. For more information, see the Docker documentation.The link provided in these instructions is for the latest version of TimescaleDB on PostgreSQL 18. To find other Docker tags you can use, see the Dockerhub repository.
View logs in Docker
If you have TimescaleDB installed in a Docker container, you can view your logs using Docker, instead of looking in
/var/log. For more information, see the Docker documentation on logs.
You can run TimescaleDB inside Kubernetes using the TimescaleDB Docker container images.
To run TimescaleDB inside Kubernetes, you need:
- Self-managed Kubernetes or a Kubernetes Turnkey Cloud Solution.
- kubectl for command-line interaction with your cluster.
Integrate TimescaleDB in a Kubernetes cluster
Section titled “Integrate TimescaleDB in a Kubernetes cluster”Running TimescaleDB on Kubernetes is similar to running PostgreSQL. This procedure outlines the steps for a non-distributed system.
To connect your Kubernetes cluster to self-hosted TimescaleDB running in the cluster:
- Create a default namespace for Tiger Data components
-
Create the Tiger Data namespace:
Terminal window kubectl create namespace tigerdata -
Set this namespace as the default for your session:
Terminal window kubectl config set-context --current --namespace=tigerdata
For more information, see Kubernetes Namespaces.
-
- Set up a persistent volume claim (PVC) storage
To manually set up a persistent volume and claim for self-hosted Kubernetes, run the following command:
kubectl apply -f - <<EOFapiVersion: v1kind: PersistentVolumeClaimmetadata:name: tigerdata-pvcspec:accessModes:- ReadWriteOnceresources:requests:storage: 10GiEOF - Deploy TimescaleDB as a StatefulSet
By default, the TimescaleDB HA Docker image you are installing on Kubernetes uses the default PostgreSQL database, user and password. This image includes TimescaleDB and TimescaleDB Toolkit. To deploy TimescaleDB on Kubernetes, run the following command:
kubectl apply -f - <<EOFapiVersion: apps/v1kind: StatefulSetmetadata:name: timescaledbspec:serviceName: timescaledbreplicas: 1selector:matchLabels:app: timescaledbtemplate:metadata:labels:app: timescaledbspec:containers:- name: timescaledbimage: 'timescale/timescaledb-ha:pg18'env:- name: POSTGRES_USERvalue: postgres- name: POSTGRES_PASSWORDvalue: postgres- name: POSTGRES_DBvalue: postgres- name: PGDATAvalue: /var/lib/postgresql/data/pgdataports:- containerPort: 5432volumeMounts:- mountPath: /var/lib/postgresql/dataname: tigerdata-storagevolumes:- name: tigerdata-storagepersistentVolumeClaim:claimName: tigerdata-pvcEOF - Allow applications to connect by exposing TimescaleDB within Kuberneteskubectl apply -f - <<EOFapiVersion: v1kind: Servicemetadata:name: timescaledbspec:selector:app: timescaledbports:- protocol: TCPport: 5432targetPort: 5432type: ClusterIPEOF
- Create a Kubernetes secret to store the database credentials
Terminal window kubectl create secret generic tigerdata-secret \--from-literal=PGHOST=timescaledb \--from-literal=PGPORT=5432 \--from-literal=PGDATABASE=postgres \--from-literal=PGUSER=postgres \--from-literal=PGPASSWORD=postgres - Deploy an application that connects to TimescaleDB
Terminal window kubectl apply -f - <<EOFapiVersion: apps/v1kind: Deploymentmetadata:name: tigerdata-appspec:replicas: 1selector:matchLabels:app: tigerdata-apptemplate:metadata:labels:app: tigerdata-appspec:containers:- name: tigerdata-containerimage: postgres:latestenvFrom:- secretRef:name: tigerdata-secretEOF - Test the database connection
-
Create and run a pod to verify database connectivity using your connection details saved in
tigerdata-secret:Terminal window kubectl run test-pod --image=postgres --restart=Never \--env="PGHOST=$(kubectl get secret tigerdata-secret -o=jsonpath='{.data.PGHOST}' | base64 --decode)" \--env="PGPORT=$(kubectl get secret tigerdata-secret -o=jsonpath='{.data.PGPORT}' | base64 --decode)" \--env="PGDATABASE=$(kubectl get secret tigerdata-secret -o=jsonpath='{.data.PGDATABASE}' | base64 --decode)" \--env="PGUSER=$(kubectl get secret tigerdata-secret -o=jsonpath='{.data.PGUSER}' | base64 --decode)" \--env="PGPASSWORD=$(kubectl get secret tigerdata-secret -o=jsonpath='{.data.PGPASSWORD}' | base64 --decode)" \-- sleep infinity -
Launch the PostgreSQL interactive shell within the created
test-pod:Terminal window kubectl exec -it test-pod -- bash -c "psql -h \$PGHOST -U \$PGUSER -d \$PGDATABASE"
You see the PostgreSQL interactive terminal.
-
Install with PostgreSQL Kubernetes operators
Section titled “Install with PostgreSQL Kubernetes operators”You can also use PostgreSQL Kubernetes operators to simplify installation, configuration, and life cycle management:
- StackGres (includes TimescaleDB images)
- PostgreSQL Operator (Patroni)
- PGO
- CloudNativePG
You can install TimescaleDB on any local system from source.
To install TimescaleDB from source, you need:
-
PostgreSQL: Install a supported version of PostgreSQL. We recommend not using TimescaleDB with PostgreSQL 17.1, 16.5, 15.9, 14.14, 13.17, or 12.21. These minor versions introduced a breaking binary interface change that was reverted in subsequent releases. Build with PostgreSQL 17.2, 16.6, or higher.
-
Build tools:
- CMake 3.11 or later
- C language compiler (
gccorclang). On Windows, Visual Studio 2015 or later works instead, ensure you install the CMake and Git components.
- Install the latest PostgreSQL source
-
At the command prompt, clone the TimescaleDB GitHub repository:
Terminal window git clone https://github.com/timescale/timescaledb -
Change into the cloned directory:
Terminal window cd timescaledb -
Checkout the latest release. You can find the latest release tag on our Releases page:
Terminal window git checkout <latest-version>This command produces an error that you are now in
detached headstate. It is expected behavior, and it occurs because you have checked out a tag, and not a branch. Continue with the steps in this procedure as normal.
-
- Build the source
-
Bootstrap the build system:
Terminal window ./bootstrapTerminal window bootstrap.batFor installation on Microsoft Windows, you might need to add the
pg_configandcmakefile locations to your path. In the Windows Search tool, search forsystem environment variables. The path forpg_configshould beC:\Program Files\{C.PG}\<version>\bin. The path forcmakeis within the Visual Studio directory. -
Build the extension:
Terminal window cd build && makeTerminal window cmake --build ./build --config Release
-
- Configure PostgreSQL
If you have more than one version of PostgreSQL installed, TimescaleDB can only be associated with one of them. The TimescaleDB build scripts use
pg_configto find out where PostgreSQL stores its extension files, so you can usepg_configto find out which PostgreSQL installation TimescaleDB is using.-
Locate the
postgresql.confconfiguration file:Terminal window psql -d postgres -c "SHOW config_file;" -
Open the
postgresql.conffile and updateshared_preload_librariesto:Terminal window shared_preload_libraries = 'timescaledb'If you use other preloaded libraries, make sure they are comma separated.
-
Tune your PostgreSQL instance for TimescaleDB
Terminal window sudo timescaledb-tuneThis script is included with the
timescaledb-toolspackage when you install TimescaleDB. For more information, see configuration. -
Restart the PostgreSQL instance:
Terminal window service postgresql restartTerminal window pg_ctl restart
-
- Set the user password
-
Log in to PostgreSQL as
postgresTerminal window sudo -u postgres psqlYou are in the psql shell.
-
Set the password for
postgresTerminal window \password postgresWhen you have set the password, type
\qto exit psql.
-
Add the TimescaleDB extension to your database
Section titled “Add the TimescaleDB extension to your database”For improved performance, you enable TimescaleDB on each database on your self-hosted PostgreSQL instance. This section shows you how to enable TimescaleDB for a new database in PostgreSQL using psql from the command line.
- Connect to a database on your PostgreSQL instance
In PostgreSQL, the default user and database are both
postgres. To use a different database, set<database-name>to the name of that database:Terminal window psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>" - Add TimescaleDB to the databaseCREATE EXTENSION IF NOT EXISTS timescaledb;
- Check that TimescaleDB is installed\dx
You see the list of installed extensions:
List of installed extensionsName | Version | Default version | Schema | Description-------------+---------+-----------------+------------+---------------------------------------------------------------------------------------plpgsql | 1.0 | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.24.0 | 2.24.0 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)(2 rows)Press
\qto exit the list of extensions.
Supported platforms
Section titled “Supported platforms”| Operation system | Version |
|---|---|
| Debian | 13 Trixe, 12 Bookworm, 11 Bullseye |
| Ubuntu | 24.04 Noble Numbat, 22.04 LTS Jammy Jellyfish |
| Red Hat Enterprise | Linux 9, Linux 8 |
| Fedora | Fedora 35, Fedora 34, Fedora 33 |
| Rocky Linux | Rocky Linux 9 (x86_64), Rocky Linux 8 |
| ArchLinux (community-supported) | Check the available packages |
| Operation system | Version |
|---|---|
| macOS | From 10.15 Catalina to 14 Sonoma |
You can deploy TimescaleDB on the following systems:
| Operation system | Version |
|---|---|
| Microsoft Windows | 10, 11 |
| Microsoft Windows Server | 2019, 2022, 2025 |