How to Install PostgreSQL on Arch-based Linux Distributions (Manjaro)
Last Updated :
11 Jul, 2022
PostgreSQL (often called Postgres) is a free, open-source, and advanced relational database management system and is developed by The PostgreSQL Global Development Group. It is primarily written in the C Programming Language. In addition to SQL (relational) querying, Postgres also supports JSON (non-relational) querying.
This article is a step-by-step instruction for installing PostgreSQL on an Arch-based Linux system.
Installation of PostgreSQL
Step 1: Update and upgrade your system by executing the following command
$ sudo pacman -Syu
Step 2: Install PostgreSQL from the official repository using pacman package manager
$ sudo pacman -S postgresql
Step 3: Verify the installation by running
$ postgres --version
Step 4: Using the initdb command, initialize PostgreSQL's data directory
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data/'
Step 5: Start the PostgreSQL server by using systemctl command.
$ sudo systemctl start postgresql
$ sudo systemctl status postgresql
Step 6: Once again use systemctl command to enable PostgreSQL. Now, PostgreSQL will restart whenever your machine boots up.
$ sudo systemctl enable postgresql
Step 7: Now, log into the psql command-line interface with the default user 'postgres'
$ sudo -u postgres psql
Step 8: Create a new user with the following command
postgres=# CREATE USER <username> WITH ENCRYPTED PASSWORD '<password>';
Step 9: Create a new database with the following command
postgres=# CREATE DATABASE <dbname>;
Step 10: Finally, grant all permissions to the desired user on the newly created database.
postgres=# GRANT ALL PRIVILEGES ON DATABASE <dbname> TO username;
At this point, you have successfully installed and configured PostgreSQL on your Linux machine.
Uninstallation of PostgreSQL
To uninstall PostgreSQL and all of its config files run
$ sudo pacman -Rcns postgresql
Similar Reads
How to install Postman on Arch-based Linux Distributions(Manjaro)? Postman is an HTTP client used to build, test, and modify APIs. It provides a graphical user interface through which developers can generate various types of HTTP requests like GET, POST, PUT, PATCH, and DELETE. It is used by more than 20 million developers across the globe to develop RESTful APIs.
1 min read
How to Install mongodb on Arch-based Linux Distributions(Manjaro) In this article, we are going to see how to install the MongoDB server on Arch-based Linux Distributions. We are going to use the Yay AUR helper, which is one of the many AUR helpers that can be used to install MongoDB or any other AUR package. Installation of MongoDB Step 1: Update and upgrade your
2 min read
How to Install RubyMine on Manjaro (Arch-based Linux Distributions) ? The RubyMine integrated development environment (IDE) is used to develop applications in the Ruby programming language. It is developed by Jetbrains and is available as a free community edition for students and a commercial edition. The RubyMine coding environment supports highlighting, linting, cod
2 min read
How to install PyCharm IDE on Arch-based Linux Distributions(Manjaro) ? PyCharm is a cross-platform integrated development environment (IDE) developed by JetBrains, specifically for Python Programming Language. It is one of the most popular Python IDE on the market due to its features like syntax highlighting, auto code completion, profiling inspection, and debugging. I
2 min read
How to Install WebStorm IDE on Arch-based Linux Distributions (Manjaro) WebStorm is a cross-platform integrated development environment (IDE) developed by Jetbrains and is available as a free community edition for students and a commercial edition. The WebStorm coding environment supports JavaScript frameworks such as React, Vue, Angular, Express, Meteor, Cordova, and N
2 min read
How to Install CLion IDE on Arch-based Linux Distributions (Manjaro) CLion (pronounced âSea Lionâ) is a cross-platform integrated development environment (IDE) developed by Jetbrains and is available as a free community edition for students and a commercial edition. It is used for developing C++ programs and is one of the most popular C++ IDE on the market. A number
2 min read