Skip to content

Install TimescaleDB having a postgre database running on EC2 Amazon Linux 2023

0

I have installed PostgreSQL 15 on EC2 Amazon Linux 2023, and it works. I am unable to install TimescaleDB. Could you please provide the steps to follow? Optionally, starting from a new instance and reinstalling PostgreSQL as well. Thank you.

asked 9 months ago471 views
1 Answer
0

To install TimescaleDB on an EC2 instance running Amazon Linux 2023 with PostgreSQL 15, you'll need to follow these steps:

  1. First, ensure your system is up to date:
sudo dnf update -y
  1. If you haven't already installed PostgreSQL 15, you can do so with:
sudo dnf install -y postgresql15 postgresql15-server
  1. Initialize the PostgreSQL database:
sudo postgresql-setup --initdb
  1. Start and enable the PostgreSQL service:
sudo systemctl start postgresql
sudo systemctl enable postgresql
  1. To install TimescaleDB, you'll need to add the TimescaleDB repository. Create a new repository file:
sudo tee /etc/yum.repos.d/timescale_timescaledb.repo << EOL
[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/8/\$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOL
  1. Install TimescaleDB:
sudo dnf install -y timescaledb-postgresql-15
  1. After installation, you need to modify the PostgreSQL configuration to load TimescaleDB. Edit the postgresql.conf file:
sudo nano /var/lib/pgsql/data/postgresql.conf

Add the following line at the end of the file:

shared_preload_libraries = 'timescaledb'
  1. Restart PostgreSQL to apply the changes:
sudo systemctl restart postgresql
  1. Finally, connect to your PostgreSQL database and create the TimescaleDB extension:
sudo -u postgres psql
CREATE EXTENSION IF NOT EXISTS timescaledb;

After following these steps, TimescaleDB should be successfully installed and ready to use with your PostgreSQL 15 database on your EC2 instance running Amazon Linux 2023.
Sources
Connecting to a DB instance running the PostgreSQL database engine - Amazon Relational Database Service
Creating and connecting to a PostgreSQL DB instance - Amazon Relational Database Service

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.