The Wayback Machine - https://web.archive.org/web/20240609013905/https://www.geeksforgeeks.org/how-to-install-postgresql-on-arch-based-linux-distributions-manjaro/
Open In App

How to Install PostgreSQL on Arch-based Linux Distributions (Manjaro)

Last Updated : 11 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 and configure Docker on Arch-based Linux Distributions(Manjaro) ?
In this article, we are going to see how to install and configure Docker on Arch-based Linux Distributions. Docker is an open-source containerization platform used for building, running, and managing applications in an isolated environment. A container is isolated from another and bundles its software, libraries, and configuration files. Containers
2 min read
How to install Visual Studio Code on Arch-based Linux Distributions(Manjaro) ?
Visual Studio Code is free, powerful and one of the most popular IDE in the market. It is a cross-platform application and can be customized heavily by installing various extensions. All the modern programming languages like C, C++, Java, Python, JavaScript, React, Node JS, etc., are all supported by it. Features of VS CodeOpen-sourceIntegrated ter
2 min read
How to install LibreOffice on Arch-based Linux Distributions(Manjaro) ?
In this article, we will see how to install and configure LibreOffice on Arch-based Linux Distributions. LibreOffice is a free open-source office suite that allows users to create and edit documents, spreadsheets, presentations, and databases. It is available in more than 100 languages and is maintained by The Documentation Foundation. It is primar
1 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. It comes with built-in support for Python framework
2 min read
How to install Intellij Idea on Arch-based Linux Distributions(Manjaro) ?
IntelliJ is a cross-platform integrated development environment(IDE) developed by Jetbrains and is available as an Apache 2 Licensed community edition and a commercial edition. It is primarily used for developing computer software written in Java, Kotlin, Groovy, and other JAR-based languages. It is one of the most popular Java IDE on the market du
2 min read
How to install Eclipse IDE on Arch-based Linux Distributions(Manjaro) ?
Eclipse is an open-source and cross-platform integrated development environment(IDE) and is used for developing applications in Java, C/C++, PHP, Python, Ruby, etc. Since 2001, it has been maintained by the Eclipse foundation and primarily written in Java. It is the second most popular Java IDE on the market due to its features like auto code compl
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 of features are included in the tool, such as code
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 NodeJS. Features of WebStormCross-platformFree comm
2 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 system by running $ sudo pacman -Syu Step 2: Befo
2 min read
How to Install and configure MySQL on Arch-based Linux Distributions(Manjaro)
MySQL is an open-source relational database management system developed by Oracle based on structured query language (SQL). It is primarily written in C and C++ programming languages and licensed under the GNU Public License. The client-end API is used to query, filter, sort, group, and modify data stored in the database table in the form of rows a
2 min read