DEV Community

Cover image for Unleashing the Power of PostgreSQL 14: A Step-by-Step Guide to Installing from GitHub
Hammad Ahmed ~
Hammad Ahmed ~

Posted on

Unleashing the Power of PostgreSQL 14: A Step-by-Step Guide to Installing from GitHub

Introduction

Hey there tech fellas! I welcome you all to this thrilling adventure into unleashing the true power and potential of PostgreSQL 14. No matter the background of your technical skill-set, this blog will definitely help you.

I have made this guide easy enough that any kind of person - be it a database manager, administrator, a programmer, a data scientist, or even an AI specialist can use this blog to set up PostgreSQL 14 on their machine.

Step 01: Understanding PostgreSQL & its Features

It's important to understand the fundamentals of Postgres 14 and why it's a game-changer in the database industry before we start the installation procedure. We'll examine the most recent changes, enhanced performance, and noteworthy innovations that Postgres 14 offers. But for that, you do not have to go anywhere else as your boy got you covered!

Check out my detailed blog on the revolutionary features of PostgreSQL 14 - Powering Your Data: An Extensive Guide of the Basic Concepts and Revolutionary Features of PostgreSQL 14

Step 02: Uninstall PostgreSQL from your machine!

Lol, you indeed read that heading the right way! In order to make it real easy for you to install and configure your new PostgreSQL 14 installation - its necessary for you to uninstall any unstable or other builds of PostgreSQL (Unless you know what you are doing -- then ofcourse you can even have tens of versions of PostgreSQL on your machine if you know how to manage all of them -- Yes, it is possible!)

Step 03: Environment Preparation

We need to get our hands filthy and get ready for the installation in order to ensure a seamless process. Hence, make sure your system is in the form to install a new technology!

Step 04: Cloning the Repository of PostgreSQL 14

It can be intimidating to comprehend the GitHub repository landscape, but do not worry! We'll clone the repository together!

In order to clone the repository follow the following steps:

  • Make a new directory named PostgreSQL14 anywhere you want.
  • Change directory to the one you made by: cd PostgreSQL14
  • Clone the branch: git clone -b REL_14_STABLE https://github.com/postgres/postgres
  • Make sure to change directory to the cloned one: cd postgres

Step 05: Configuring the Build

It's now time to configure the build after the repository has been cloned. We'll examine more closely at the many build options, compile flags, and customization options to fit Postgres 14 to your unique requirements.

In order to configure a successful build, follow these steps:

  • Make sure that you are inside the **postgres* repository*
  • ./configure --prefix=$(pwd) --enable-cassert --enable-debug

Optional: If you get any errors like readline is not present in your system then install readline or any other dependencies using sudo-apt

  • To know that your config was successful, double verify it by matching the last two lines of your config with these ones:

config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

  • After a successful config, you need to use Make; make install

Optional: If you get any errors like Bison or Flex is not present in your system then install them using sudo-apt sudo apt-get install flex bison
Note: After installing Bison or Flex etc, you need to run the ./configure command again followed by make install command so that Makefiles are aware of the newly installed libraries. ./configure --prefix=$(pwd) --enable-cassert --enable-debug and make install

Step 06: Setting Up Data Folder

Now, as you are done with with the Setup and Configuration - You need to setup a Data Folder in which your data will reside.

In order to do that, follow these steps:

  • Create a new folder named data while being inside postgres directory. So your path will be: PostgreSQL14/postgres/data
  • While being inside postgres folder, run the command in order to make data folder a DB Cluster so that it stores databases: bin/initdb -D data
  • Start the DB server using this command: bin/pg_ctl -D data -l logfile start

Step 07: Creating Test Database

Now, you can make a test database and run your PostgreSQL queries right away!

In order to make test database and use it using PSQL - Do the following:

  • Go inside the postgres directory
  • Run this command: bin/createdb test - This will create a database named test
  • Now, make sure your server is running, if not then run this command while being inside the postgres directory: bin/pg_ctl -D data -l logfile start
  • Run PSQL now: bin/psql test

And voila! Now just run your queries on PostgreSQL!

Step 08: Tadaa, Your Setup is Done!

Now, you can start and stop your DB server using the following commands. These will be the only commands that you would have to use now.
Start: bin/pg_ctl -D data -l logfile start
Stop: bin/pg_ctl -D data -l logfile stop

Conclusion

Now that our epic voyage has come to an end, you are prepared to successfully install PostgreSQL 14 from GitHub. Accept the might of this outstanding database system and let it take your data projects to new heights. I wish you secure, lightning-fast, and infinitely scalable databases!

Follow me for more blogs and content related to PostgreSQL and Technology. Hammad Ahmed signing off! 😄

Top comments (0)