Install self-hosted TimescaleDB on Red Hat-based systems

You can host TimescaleDB yourself on your Red Hat, CentOS, or Fedora system. These instructions use the yum package manager on these distributions:

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • CentOS 7
  • CentOS 8
  • Rocky Linux 8
  • Rocky Linux 9
  • Fedora 33
  • Fedora 34
  • Fedora 35
warning

If you have already installed PostgreSQL using a method other than the yum or dnf package manager, you could encounter errors following these instructions. It is safest to remove any existing PostgreSQL installations before you begin. If you want to keep your current PostgreSQL installation, do not install TimescaleDB using this method. Install from source instead.

Installing self-hosted TimescaleDB on Red Hat-based systems

  1. At the command prompt, as root, add the PostgreSQL third party repository to get the latest PostgreSQL packages:

  2. Create the Timescale repository:

  3. Update your local repository list:

    1. yum update
  4. Install TimescaleDB:

    1. yum install timescaledb-2-postgresql-14
    note

    When installing on CentOS 8 or Red Hat Enterprise Linux 8 you need to disable the built-in PostgreSQL module in the system using the sudo dnf -qy module disable postgresqlcommand.

  5. Initialize the database:

    1. /usr/pgsql-14/bin/postgresql-14-setup initdb

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. Run the timescaledb-tune script using the sudo timescaledb-tune --pg-config=/usr/pgsql-14/bin/pg_config command. For more information, see the configuration section.

Set up the TimescaleDB extension

When you have PostgreSQL and TimescaleDB installed, you can connect to it using the psql command-line utility.

Install psql on CentOS

You can use the yum package manager on CentOS systems to install the psql tool.

Installing psql using the apt package manager

  1. Make sure your apt repository is up to date:

    1. yum update
  2. Install the postgresql-client package:

    1. dnf install postgresql14

Setting up the TimescaleDB extension

  1. Enable and start the service:

    1. systemctl enable postgresql-14
    2. systemctl start postgresql-14
  2. Connect to the PostgreSQL instance as the postgres superuser:

    1. -u postgres psql

    If your connection is successful, you see a message similar to this, followed by the psql prompt:

    1. could not change directory to "/root": Permission denied
    2. psql (14.5)
    3. Type "help" for help.
    4. postgres=#
  3. Set the password for the postgres user using:

    1. \password postgres
  4. Exit from PostgreSQL using the command \q.

  5. Use psql client to connect to PostgreSQL:

    1. psql -U postgres -h localhost
  6. At the psql prompt, create an empty database. Our database is called tsdb:

    1. CREATE database tsdb;
  7. Connect to the database you created:

    1. \c tsdb
  8. Add the TimescaleDB extension:

    1. CREATE EXTENSION IF NOT EXISTS timescaledb;
  9. Check that the TimescaleDB extension is installed by using the \dx command at the psql prompt. Output is similar to:

    1. tsdb-# \dx
    2. List of installed extensions
    3. Name | Version | Schema | Description
    1. -------------+---------+------------+-------------------------------------------------------------------
    2. plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
    3. timescaledb | 2.7.0 | public | Enables scalable inserts and complex queries for time-series data
    4. (2 rows)

After you have created the extension and the database, you can connect to your database directly using this command:

  1. psql -U postgres -h localhost -d tsdb

Where to next

Now that you have your first TimescaleDB database up and running, you can check out the TimescaleDB section in our documentation, 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 TimescaleDB and time-series data, check out our tutorials section.

You can always contact us if you need help working something out, or if you want to have a chat.