02pg-PostgreSQL Installation

Introduction

PostgreSQL is a powerful open-source relational database management system (RDBMS) known for its stability, extensibility, and compliance with SQL standards. In this guide, we will explore two methods for installing PostgreSQL: using package managers and building from source code.

PRE – Requisite: PGDG Repository – PostgreSQL Global Development Group Repository

When we install Actual PostgreSQL Software it will automatically bring/download it from PGDG Repository for that Before Actual PostgreSQL Software installation we have to install PGDG Repository Package

To Check PGDG Repository has been installed or not

Create Postgres User:

 

Method 1: Installing PostgreSQL using Package Managers

Package managers simplify the installation process by handling dependencies and providing easy updates. Here are the steps to install PostgreSQL using popular package managers:

1. Ubuntu / Debian

To install PostgreSQL on Ubuntu or Debian, open a terminal and run the following commands:

2. CentOS / Fedora

For CentOS or Fedora, use the following commands:

Method 2: Building PostgreSQL from Source Code

Building from source code allows for more customization and control over the installation. Here are the steps to build PostgreSQL:

1. Install Dependencies

Before compiling PostgreSQL, ensure that you have the necessary dependencies installed. Refer to the PostgreSQL documentation for the specific requirements based on your operating system.

2. Download the Source Code

Visit the official PostgreSQL website (https://www.postgresql.org/) and download the latest stable release. Extract the downloaded archive to a directory of your choice.

3. Configure and Build

In the terminal, navigate to the extracted PostgreSQL source code directory and run the following commands:

Default Installation Path:

Custom Installation Path:

4. Initialize the Database

After installation, initialize the PostgreSQL database cluster by running:

5. Start PostgreSQL

To start the PostgreSQL server, run:

Output:

Method 3 : Manual Download Packages based PostgreSQL Software

Before this verify/checks your currently using Operating System Version for that use the command

Goto : https://yum.postgresql.org/
—>Select the Major version of PostgreSQL Software
—>Select the OS Version
—>
Download the version of your choice.


Lets Try Downloading and installing the older version of postgresql.

Conclusion

PostgreSQL can be installed using package managers or by building from source code. Package managers provide a straightforward installation process, while building from source code allows for more customization. Choose the method that best suits your needs and enjoy the power and reliability of PostgreSQL for your database management.

Leave a Reply

Your email address will not be published. Required fields are marked *