Install Postgres on Ubuntu: Hevo’s Guide for Beginners

by Haider Ali Khan 0

Install Postgres on Ubuntu Hevo's Guide for Beginners

PostgreSQL, which is also known as Postgres, is a relational database management system that puts emphasis on compliance with SQL and expandability. It is one of the most advanced open-source database management systems that has a Debian-based Linux distribution.

We can also use programming languages such as C, C++, Java, etc. with PostgreSQL and can also add some custom functions using these programming languages. To learn Linux as a beginner the easiest place to start is Ubuntu Linux. Ubuntu is an open-source desktop operating system that can also operate on the cloud and IoT.

Further in the article, we will learn about how to Install Postgres on Ubuntu and also how to access the Postgres shell.

Some key features of Postgres are as follows:

  • Customizable: To suit your requirements PostgreSQL can be customized by the development of some plugins and it can also add some custom functions using programming languages like C, C++, Java, etc.
  • Frequent Updates: The most recent Version 13.1 of PostgreSQL was updated on 12 November 2020.
  • MVCC Features: PostgreSQL is the first Database Management System to have multi-Version Concurrency Control (MVCC) features.
  • Open-Source: This is an Object-Relational Database Management System(ORDBMS) that allows PostgreSQL to provide the functionality of an Object-Oriented and Relational Database. It is a free and Open-Source ORDBMS.

How to add the Postgres repository on Ubuntu Linux?

The process is relatively in which you run commands to add keys and files to the PostgreSQL repository. If you do not want the version of Ubuntu that you have you can also use the PostgreSQL Apt Repository. This repository will incorporate into your system and will automatically update all the supported versions of PostgreSQL.

How to install Postgres on Ubuntu Linux?

By default, Ubuntu already has PostgreSQL, we can Install Postgres Ubuntu easily by using this command. This command will help you install the latest version of PostgreSQL on Ubuntu with some commonly used adds-on with it.

After you have Install Postgres Ubuntu, you can use these commands to stop, start and enable.

You can run this command to ensure that PostgreSQL is installed and running properly

How to access the Postgres shell?

A Postgres user is automatically created whenever you install PostgreSQL. This user is known as the superuser of equivalent and is similar to the root user of MySQL.

If you want to access the PostgreSQL shell for managing the database first you have to switch the user and then log in to the shell as a Postgres user.

Whenever you want to create and start managing the  PostgreSQL databases, use the psql command to beseech the interactive shell.

Now, we come to set the password for Postgres using the Sudo command, this is an alternative to access the PostgreSQL without switching the users.

For creating a change PostgreSQLpassword, login as a Postgres user and invoke the psql command shell using this command.

Now, run these commands to change the admin password.

After doing that, you can quit and exit by using this command.

Also Read – How to Install MongoDB on Ubuntu at Hevo Data Blog.

Conclusion

In this article, we learned how to Install Postgres Ubuntu, how useful can Ubuntu prove to be considering its key features, and how to access the Postgres shell for the creation and management of the database.