How to Start PostgreSQL on Ubuntu 22.04


Excited to get started with PostgreSQL on your Ubuntu 22.04? This simple guide will show you how to begin using PostgreSQL, an awesome open-source database system, on your Ubuntu 22.04. So, explore PostgreSQL’s cool features to manage your data smoothly and efficiently!

This guide is all about starting the PostgreSQL service on Ubuntu 22.04.

Features of PostgreSQL

Here, we have compiled the commendable features of PostgreSQL:

  • Make it Your Own: Customize data types, indexes, and functions to fit your needs.
  • Keep Data Safe: Ensure your data is secure and consistent with strong transaction support.
  • Find Data Fast: Speed up data retrieval with smart indexing techniques.
  • Search Like a Pro: Easily search through lots of text data using full-text search.
  • Everyone’s Invited: Let multiple users access the database at once without any issues.
  • Handle All Data Types: Easily manage flexible data like JSON and NoSQL formats.
  • No Downtime Allowed: Keep your data safe with backups and minimize downtime risk.
  • Connect with Others: Connect with other databases and external sources without trouble.
  • Add Extra Superpowers: Boost PostgreSQL with your own cool features using custom extensions.
  • Time-Saving Tricks: Make tasks easier with triggers and stored procedures.

How to Install PostgreSQL on Ubuntu 22.04?

In order to install PostgreSQL on Ubuntu 22.04, firstly, it is required to update the packages of the system:

sudo apt update

After updating system packages, write out the provided command for PostgreSQL installation:

sudo apt install postgresql

Hold on, until the PostgreSQL installation gets complete:

The above error-free output represents that PostgreSQL has been successfully installed on our Ubuntu 22.04 machine.

How to Start/Enable PostgreSQL on Ubuntu 22.04?

Before using PostgreSQL, it is crucial to start its service with the following command:

sudo service postgresql start

Now, validate if the PostgreSQL service has been activated or not:

sudo service postgresql status

It can be observed that the specified service is activated:

After starting the relevant service, PostgreSQL is now running in the background and can be accessed anytime.

How to Access/Use PostgreSQL on Ubuntu 22.04?

For accessing PostgreSQL on Ubuntu 22.04 utilize this command:

sudo -u postgres psql

As you can see, we have opened the “help” manual of PostgreSQL:

How to Quit/Exit from PostgreSQL on Ubuntu 22.04?

For the purpose of exiting or quitting from PostgreSQL, type this command:

\q

How to Uninstall/RemovePostgreSQL from Ubuntu 22.04?

In order to remove or uninstall PostgreSQL from Ubuntu 22.04, copy the below-mentioned command:

sudo apt remove postgresql -y

For the confirmation of the removal of the deleted package run this command:

sudo apt autoremove

That’s all about starting PostgreSQL on Ubuntu 22.04.

Conclusion

For the purpose of starting PostgreSQL on Ubuntu 22.04, firstly, run this command “sudo apt install postgresql”. After that, start the service with “sudo service postgresql start”. Lastly, for the validation, run the “sudo service postgresql status” command. Moreover, you can access and use PostgreSQL according to the provided instructions.

Print Friendly, PDF & Email
Categories