AlmaLinuxRHEL Based

How To Install TimescaleDB on AlmaLinux 9

Install TimescaleDB on AlmaLinux 9

In this tutorial, we will show you how to install TimescaleDB on AlmaLinux 9. For those of you who didn’t know, TimescaleDB, an open-source time-series database extension for PostgreSQL, is a powerful tool that offers scalability, performance, and flexibility.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of TimescaleDB on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.

Prerequisites

  • A server running one of the following operating systems: AlmaLinux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for TimescaleDB.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install TimescaleDB on AlmaLinux 9

Step 1. Before diving into the installation process, ensure your AlmaLinux 9 system is up-to-date. Run the following commands in your terminal:

sudo dnf update

Step 2. Installing PostgreSQL.

Before installing TimescaleDB on AlmaLinux 9, you need to install PostgreSQL, as TimescaleDB is an extension of PostgreSQL. Here are the step-by-step instructions for installing PostgreSQL and TimescaleDB on AlmaLinux 9:
sudo dnf install postgresql-server postgresql-contrib

Initialize the PostgreSQL database:

sudo postgresql-setup --initdb

Start the PostgreSQL service:

sudo systemctl start postgresql

Enable the PostgreSQL service to start at boot:

sudo systemctl enable postgresql

Verify that PostgreSQL is running:

sudo systemctl status postgresql

You should see a message indicating that PostgreSQL is active and running.

Step 3. Installing TimescaleDB on AlmaLinux 9.

TimescaleDB maintains its own repository for easy installation. Let’s add it to your system:

sudo tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOF
[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/9/$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
EOF

Now install the TimescaleDB package using the following command below:

sudo dnf install timescaledb-postgresql-14

Initialize the TimescaleDB extension:

sudo timescaledb-tune --quiet --yes
sudo systemctl restart postgresql
sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"

Verify that TimescaleDB is installed and working:

sudo -u postgres psql -c "SELECT * FROM timescaledb_information.timescaledb_version;"

Step 4. Create Database TimescaleDB.

For example, to create a new database named idroot, you can run the following command:

createdb -U postgres idroot

Here, createdb is the command to create a new database, -U postgres specifies the PostgreSQL user to create the database, and idroot is the name of the new database.

After running the above command, you can connect to the new database using the psql command. For example, to connect to the idroot database, you can run the following command:

psql -U postgres idroot

Here, psql is the command to connect to a PostgreSQL database, -U postgres specifies the PostgreSQL user to connect to the database, and idroot is the name of the database to connect to.

Once you are connected to the new database, you can create tables and perform other operations as you would with any other PostgreSQL database.

Congratulations! You have successfully installed TimescaleDB. Thanks for using this tutorial for installing the TimescaleDB on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official TimescaleDB website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button