How to Install PostgresML on Rocky Linux 9

When you want to create and train the AI models, PostgresML is one option to consider. It is an AI application database with a machine learning extension for the PostgreSQL database to allow the users to create the AI applications. Once you have PostgresML, integrating the machine learning models when working with a PostgreSQL database becomes easier.

This post focuses on how to install PostgresML on Rocky Linux 9. We will discuss one method to install PostgresML using its source code and Docker. Take a look!

Installing PostgresML on Rocky Linux 9

A simplified way of testing the power of PostgresML in creating AI applications that harness the capacity of machine learning models is by creating a free account on the PostgresML website. They give 5 GB space for users to test PostgresML. Once you are satisfied with it, you can install it on your device by compiling its source code.

With PostgresML, you can comfortably utilize SQL to train and perform the inferences on tabular or text data to meet your goal. To compile its available source code on its GitHub code, you should have the PostgreSQL installed alongside Docker that you will use to build the AI application database.

1. Install PostgreSQL

Before you install PostgreSQL, start by updating the apt repository of your Rocky Linux 9.

Rocky Linux 9 comes with installed PostgreSQL 13, but we install PostgreSQL 14 for this case. Start by adding the PostgreSQL 14 repository by executing the following command:

sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Aftre adding the PostgreSQL 14 repository, you should disable the default version that comes pre-installed using the following command:

sudo dnf -qy module disable postgresql

You can now install PostgreSQL 14 using the following command. Press “y” when prompted for Rocky Linux 9 to install the dependency tree:

sudo dnf install postgresql14-server

Initialize the installed PostgreSQL server as follows:

sudo /usr/pgsql-14/bin/postgresql-14-setup initdb

Lastly, start the PostgreSQL server.

sudo systemctl start postgresql-14

Confirm its status to ensure that it is running.

systemctl status postgresql-14.service

2. Install Docker

Installing the latest Docker version on the Rocky Linux 9 is the ideal way when you want to build the PostgresML AI applications. Update the system package database using the following command:

Add the repository for the Docker package with the following command. You need the repository to access the latest Docker version. Run the following command to add the repository:

sudo dnf config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo

You can then install Docker and the prerequisite packages with the following command. Ensure that you confirm the installation by pressing “y” when prompted:

sudo dnf install docker-ce docker-ce-cli containerd.io

Once the installation is completed, you can start the Docker as follows:

sudo systemctl start docker

Check the Docker status to ensure that it is active to guarantee that we can build the PostgresML application on the next step.

sudo systemctl status docker

3. Install PostgresML via the Source Code

PostgresML is open-source, and you can clone its repository using “git”. If you don’t have “git” installed, quickly install it with the following command:

You can access the PostgresML code from its GitHub page. According to its installation guide, start cloning the PostgresML repository using “git”.

sudo git clone https://github.com/postgresml/postgresml.git

Once the repository completes cloning, ensure that the dockerized services are running. Then, use the “cd” command to access the “postgresml” folder.

If you check the contents of the “postgresml” folder, it contains all the necessary files that are required to complete building the PostgresML on your Rocky Linux 9. To build PostgresML, you need the extension and its dashboard app. However, you can use the Docker compose “up” command to utilize the Docker files in the cloned repository to install and build PostgresML.

All the required files are downloaded to facilitate the build. Once it is completed, you now have PostgresML installed on your Rocky Linux 9.

You can now connect to Postgres to work with the PostgresML using “psql” or any other SQL IDE. Use the following command to connect to Postgres and start utilizing it:

postgres://postgres@localhost:5433/pgml_developement

We are using port 5433 since it is the port that PostgresML utilizes to run on the local host.

Conclusion

Installing PostgresML on Rocky Linux 9 involves a couple of steps. This post detailed the route to install PostgresML locally on your system. If you only need to test it, access its website and sign up to get a free account to train and test your machine learning models. That’s it!

source

Leave a Comment