This document explains how to create a package-specific local repository for the installation of PostgreSQL-16 from a local repository.
First, let's install the necessary packages to download and create repositories:
dnf install -y yum-utils createrepo
At this stage, we can download all the dependencies for PostgreSQL-16, along with their sub-dependencies, using the repotrack
command. Ensure that the desired packages are available for download.
Now, add the PostgreSQL repositories to the system for PostgreSQL-16 to be downloaded:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
You can confirm the availability of the package(s) for download using the dnf search package_name
command:
Once you've confirmed the availability, you can start the download process.
You can specify the download directory using the repotrack
command; otherwise, it will download to the current directory.
Use the following command to download the necessary packages for postgresql16-server
to the /var/www/html/repos/postgres directory:
repotrack --downloaddir=/var/www/html/repos/postgres postgresql16-server
After the download, convert the downloaded RPM packages into a repository format using the createrepo
command:
createrepo /var/www/html/repos/postgres
After this step, you'll observe that a folder named repodata has been created under /var/www/html/repos/postgre.
Now, we can define the created repository to the Linux system. To do this, we need to remove the old repository definitions first for our changes to take effect.
mkdir -p /etc/yum.repos.d/old
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/old/
With the above steps, we moved all old repository definitions to the /etc/yum.repos.d/old directory. Now, let's create our own repository definition file.
vi /etc/yum.repos.d/local-postgres.repo
In the VI editor, save and exit after entering the following text into the file:
[LocalRepository-PostgreSQL16]
name=RL9 - Local PostgreSQL16-Server Repository
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=file:///var/www/html/repos/postgres
If we read the file using the cat
command, the output should look like the following:
After these steps, to activate our repository, we need to clean the caches of the dnf package manager and rescan the repo list. We can do this with the following commands:
dnf clean all
dnf update
Let's view our repo using the dnf repolist
command:
Finally, let's verify the correctness of the actions taken by installing postrgesql16-server
from the local repository:
dnf install postgresql16-server
The installation process has been successfully completed! The red box indicates that all the necessary packages were installed from the local repository.
Translated By ChatGPT3.5
Top comments (0)