ROOT User Approach – How to Install and Configure PostgreSQL 13 in UBUNTU 14

How to install PostgreSQL 13 in UBUNTU From Repository

PostgreSQL can be installed by means of two ways

  1. Installing from source
  2. Installing binary packages

Each method has its own advantages and disadvantages, however, we will limit this post to learn how to install PostgreSQL using binaries packages.

Follow the steps here to get the automated scripts to install PostgreSQL 13 in RHEL 7.

Install PostgreSQL 13 – UBUNTU 16.04[step by step]:

I assume that all the prerequisites for installing PostgreSQL have met, I highly recommend to follow this link to learn more about prerequisites.

Check the version of ubuntu

Open the following link to select Linux version.

After selecting the ubuntu options, I got the following options.

Sample output after executing the above commands

The following command will install PostgreSQL 13 on UBUNTU 16

apt-get -y install postgresql

To start the cluster run the below command

pg_ctlcluster 13 main start

From the above output, we can confirm that pg_ctlcluster is initdb equivalent in ubuntu.

During installation, PostgreSQL first creates a common configuration file at

/etc/postgresql-common/createcluster.conf

While initializing a new cluster, PostgreSQL takes the data directory location from the above configuraton file.

How to initialize PostgreSQL 13 database cluster in a non default location

  • Stop PostgreSQL 13 database cluster if it is already running

root@devops-git:~# service postgresql stop

  • Modify the data directory location in common configuration file

  • Create required directories

mkdir -p /u01/pgsql/13
chown -R postgres:postgres /u01/pgsql/13

  • Initialize the new cluster with pg_ctlcluster command

pg_createcluster –start 13 custom

Sample output

  • Start the cluster

pg_ctlcluster 13 custom start

The above process creates a new instance called custom, we can find that from below tool

Now stop previous cluster created by default with

systemctl stop postgresql@13-main

Now check the status of postgresql service

 

Words from postgreshelp

Thank you for giving your valuable time to read the above information. I hope the content served your purpose in reaching out the blog.
Suggestions for improvement of the blog are highly appreciable. Please contact us for any information/suggestion/feedback.

If you want to be updated with all our articles

please follow us on Facebook Twitter
Please subscribe to our newsletter.

Leave a Reply