avatarMynotesoracleDBA

Summary

The web content provides a detailed guide on how to install the pg_repack extension on a Linux system, which is used to remove bloat from tables and indexes and restore the physical order of clustered indexes in PostgreSQL databases.

Abstract

The article titled "How To install Pg_repack In Linux" outlines a step-by-step process for installing the pg_repack extension. It begins by explaining that pg_repack is an open-source tool for optimizing PostgreSQL databases by eliminating unused space in tables and indexes and optionally reordering clustered indexes. The installation process includes verifying the operating system version, updating existing packages, installing necessary dependencies such as readline-devel, openssl-devel, postgresql-devel, and gcc, and installing the PostgreSQL client-server package. It also involves downloading and verifying the appropriate version of pg_repack (specifically version 1.4.5 for PostgreSQL version 12 compatibility), unzipping the package, and compiling it using the make command. The final step is to verify the installation by checking the pg_repack version.

Opinions

  • The authors emphasize the importance of using the correct pg_repack version (1.4.5) for compatibility with PostgreSQL version 12, implying that using an incompatible version could lead to issues.
  • The use of wget for downloading packages and the PostgreSQL static package suggests a preference for manual installation over package manager-based installation, which may offer more control over the installation process.
  • The guide assumes a certain level of technical expertise, as it does not provide in-depth explanations for each command or step, indicating that it is tailored for system administrators or users familiar with Linux and PostgreSQL.
  • The inclusion of gcc in the installation steps implies that the guide is not limited to package installation but also covers the compilation of source code, which is a more advanced aspect of software installation.
  • The guide's focus on verifying each step, such as checking the OS version and verifying the downloaded package, reflects a cautious approach to system administration that prioritizes stability and reliability.

How To install Pg_repack In Linux

Here we are going to see step by step of pg_repack installation

What is a Pg_repack?

  • Pg_repack is an extension that was created and maintained as an open-source project by several authors.
  • It removes the bloat from tables and indexes and optionally restores the physical order of clustered indexes.

Pg_repack Installation steps

s-1:

To verify the OS version

[ec2-user@ip-172311365 ~]$ cat /etc/os-release

s-2:

Switch as a root user and update existing packages

[root@ip-172-22-13-65 ~]# yum update -y

s-3:

Wget is a free and open-source software package for getting files using HTTP, HTTPS, and FTP Internet protocols.

[root@ip-172-22-13-65 ~]# yum install wget

s-4:

Switch into ec2-user and execute the below dependency libraries

  • Readline-devel = Files needed to develop programs which use the readline library,
  • OpenSSL= a toolkit for supporting cryptography.
sudo yum install readline-devel openssl-devel

s-5:

The PostgreSQL-devel package is designed for, PostgreSQL development header files and libraries.

sudo yum install postgresql-devel

s-6:

The GNU Compiler Collection (GCC) is a collection of compilers and libraries for C, C++, Objective-C, Fortran, Ada, Go , and D, programming languages. Many open-source projects including the GNU tools and the Linux kernel are compiled with GCC.

sudo yum install gcc

s-7:

Install PostgreSQL client-server rpm , we have to install the PostgreSQL package based on the PostgreSQL devel

wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/postgresql-static-9.2.24-8.el7_9.x86_64.rpm

s-8:

Verify the downloaded package using the below command

ls -lrth

s-9:

Install the PostgreSQL downloaded rpm package

sudo rpm -i postgresql-static-9.2.24-7.el7_9.x86_64.rpm

s-10:

Download the pg_repack 1.4.5 as per the support suggestion PostgreSQL version 12 will support the pg_repack 1.4.5 only, in case if we install the pg_repack latest version 1.4.7 Due to incompatible of pg_repack version will not able to perform pg_repack

wget http://api.pgxn.org/dist/pg_repack/1.4.5/pg_repack-1.4.5.zip

s-11:

Unzip the downloaded the pg_repack zip file

unzip pg_repack-1.4.5.zip

s-12:

once we did the unzip of the pg_repack just go to that directory below

cd pg_repack-1.4.5

s-13:

Execute the make command to Ensure no errors are reported.

make

s-14:

To verify the pg_repack version

cd bin
./pg_repack --version
Pgrepack
Postgres
Postgresql
Database Administration
Recommended from ReadMedium
avatarShrikant Bhadane
Save your AWS ECR cost

Hi All,

3 min read