You can host TimescaleDB yourself, on any system, by downloading the source code and compiling it. These instructions do not require the use of a package manager or installation tool.

Want to skip these steps?

Deploy a Timescale service in the cloud. We tune your database for performance and handle scalability, high availability, backups and management so you can relax.

Try for free

Before you start, make sure you have installed:

You also need:

  • CMake version 3.11 or later for your operating system. For more information about CMake installation, including downloads and instructions, see the CMake documentation.
  • C language compiler for your operating system, such as gcc or clang.
  • Check the compatibility matrix of TimescaleDB versions with PostgreSQL versions.
Note

If you are using a Microsoft Windows system, you can install Visual Studio 2015 or later instead of CMake and a C language compiler. Ensure you install the Visual Studio components for CMake and Git when you run the installer.

  1. At the command prompt, clone the TimescaleDB GitHub repository:

    git clone https://github.com/timescale/timescaledb
  2. Change into the cloned directory:

    cd timescaledb
  3. Checkout the latest release. You can find the latest release tag on our Releases page:

    git checkout 2.14.0

    This command produces an error that you are now in detached head state. 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.

  4. Bootstrap the build system:

    ./bootstrap

    For installation on Microsoft Windows, you might need to add the pg_config and cmake file locations to your path. In the Windows Search tool, search for system environment variables. The path for pg_config should be C:\Program Files\PostgreSQL\<version>\bin. The path for cmake is within the Visual Studio directory.

  5. Build the extension:

    cd build && make
  6. Install TimescaleDB:

    make install

When you install TimescaleDB from source, you need to do some additional PostgreSQL configuration to add the TimescaleDB library.

Important

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_config to find out where PostgreSQL stores its extension files, so you can use pg_config to find out which PostgreSQL installation TimescaleDB is using.

  1. Locate the postgresql.conf configuration file:

    psql -d postgres -c "SHOW config_file;"
  2. Open the postgresql.conf file in your preferred text editor, and locate the shared_preload_libraries parameter. Uncomment the line, and add timescaledb:

    shared_preload_libraries = 'timescaledb'

    If you use other preloaded libraries, make sure they are comma separated.

  3. Restart the PostgreSQL instance:

    service postgresql restart

When you have completed the installation, you need to configure your database so that you can use it. The easiest way to do this is to run the timescaledb-tune script, which is included with the timescaledb-tools package. For more information, see the configuration section.

When you have PostgreSQL and TimescaleDB installed, you can connect to it from your local system using the psql command-line utility. This is the same tool you might have used to connect to PostgreSQL before, but if you haven't installed it yet, check out our installing psql section.

  1. On your local system, at the command prompt, connect to the PostgreSQL instance as the postgres superuser:

    psql -U postgres -h localhost

    If your connection is successful, you'll see a message like this, followed by the psql prompt:

    psql (13.3, server 12.8 (Ubuntu 12.8-1.pgdg21.04+1))
    SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
    Type "help" for help.
    tsdb=>
  2. At the psql prompt, create an empty database. Our database is called example:

    CREATE database example;
  3. Connect to the database you created:

    \c example
  4. Add the TimescaleDB extension:

    CREATE EXTENSION IF NOT EXISTS timescaledb;
  5. You can now connect to your database using this command:

    psql -U postgres -h localhost -d example

You can check that the TimescaleDB extension is installed by using the \dx command at the psql prompt. It looks like this:

tsdb=> \dx
List of installed extensions
-[ RECORD 1 ]------------------------------------------------------------------
Name | pg_stat_statements
Version | 1.7
Schema | public
Description | track execution statistics of all SQL statements executed
-[ RECORD 2 ]------------------------------------------------------------------
Name | plpgsql
Version | 1.0
Schema | pg_catalog
Description | PL/pgSQL procedural language
-[ RECORD 3 ]------------------------------------------------------------------
Name | timescaledb
Version | 2.5.1
Schema | public
Description | Enables scalable inserts and complex queries for time-series data
-[ RECORD 4 ]------------------------------------------------------------------
Name | timescaledb_toolkit
Version | 1.3.1
Schema | public
Description | timescaledb_toolkit
tsdb=>

Now that you have your first Timescale database up and running, you can check out the Use Timescale section, and find out what you can do with it.

If you want to work through some tutorials to help you get up and running with Timescale and time-series data, check out the tutorials section.

Keywords

Found an issue on this page?

Report an issue!