You can host TimescaleDB yourself, on your Debian-based, Red Hat-based, or Arch
Linux-based systems. These instructions use the apt
, yum
, and pacman
package manager on these distributions:
Debian | Ubuntu | Red Hat Enterprise | Rocky Linux | Fedora |
---|---|---|---|---|
Debian 10 Buster | Ubuntu 20.04 LTS Focal Fossa | Red Hat Enterprise Linux 7 | Rocky Linux 8 | Fedora 33 |
Debian 11 Bullseye | Ubuntu 22.04 LTS Jammy Jellyfish | Red Hat Enterprise Linux 8 | Rocky Linux 9 | Fedora 34 |
Red Hat Enterprise Linux 9 | Fedora 35 |
Warning
If you have already installed PostgreSQL using a method other than the apt
package manager maintained by Debian or Ubuntu archive, yum
, or pacman
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.
At the command prompt, as root, add the PostgreSQL third party repository to get the latest PostgreSQL packages:
apt install gnupg postgresql-common apt-transport-https lsb-release wgetRun the PostgreSQL repository setup script:
/usr/share/postgresql-common/pgdg/apt.postgresql.org.shAdd the TimescaleDB third party repository:
DebianUbuntuecho "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.listInstall TimescaleDB GPG key
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add -Note
For Ubuntu 21.10 and later use this command to install TimescaleDB GPG key
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:
apt updateInstall TimescaleDB:
apt install timescaledb-2-postgresql-14Note
If you want to install a specific version of TimescaleDB, instead of the most recent, you can specify the version like this:
apt-get install timescaledb-2-postgresql-12='2.6.0*' timescaledb-2-loader-postgresql-12='2.6.0*'
You can see the full list of TimescaleDB releases by visiting the releases page. Note that older versions of TimescaleDB don't always support all the OS versions listed above.
Configure your database by running the
timescaledb-tune
script, which is included with thetimescaledb-tools
package. Run thetimescaledb-tune
script using thesudo timescaledb-tune
command. 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.
You can use the apt
on Debian-based systems, yum
on Red Hat-based systems,
and pacman
package manager to install the psql
tool.
Make sure your
apt
repository is up to date:apt-get updateInstall the
postgresql-client
package:apt-get install postgresql-client
Restart PostgreSQL and create the TimescaleDB extension:
Restart the service after enabling TimescaleDB with
timescaledb-tune
:systemctl restart postgresqlOn your local system, at the command prompt, open the
psql
command-line utility as thepostgres
superuser:sudo -u postgres psqlIf your connection is successful, you'll see a message like this, followed by the
psql
prompt:psql (15.0 (Ubuntu 15.0-1.pgdg20.04+1), server 14.5 (Ubuntu 14.5-2.pgdg20.04+2))SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)Type "help" for help.Set the password for the
postgres
user:\password postgresExit from PostgreSQL:
\qUse
psql
client to connect to PostgreSQL:psql -U postgres -h localhostAt the
psql
prompt, create an empty database. Our database is calledtsdb
:CREATE database tsdb;Connect to the database you created:
\c tsdbAdd the TimescaleDB extension:
CREATE EXTENSION IF NOT EXISTS timescaledb;Check that the TimescaleDB extension is installed by using the
\dx
command at thepsql
prompt. Output is similar to:tsdb-# \dxList of installed extensionsName | Version | Schema | Description-------------+---------+------------+-------------------------------------------------------------------plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural languagetimescaledb | 2.7.0 | public | Enables scalable inserts and complex queries for time-series data(2 rows)
After you have created the extension and the database, you can connect to your database directly using this command:
psql -U postgres -h localhost -d 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.
You can always contact us if you need help working something out, or if you want to have a chat.
Keywords
Found an issue on this page?
Report an issue!