Press Ctrl/Cmd + P to print
or save as PDF

PostgreSQL Installation on Linux VPS Server in 5 Simple Steps (CentOS 7)

PostgreSQL is an open-source relational database management system used by multiple platforms and VPS. For relational queries, PostgreSQL uses SQL, whereas, for non-relational queries, it uses JSON. PostgreSQL is a scalable and dependable database management system with advanced optimization features which would be a good addition to your Linux VPS server if you needed one. In this article, we will be guiding you on how to install PostgreSQL onto your server. The Linux distribution used in this guide is CentOS 7

Step 1: Access Server With SSH

Before making any installation on your VPS, it is necessary to access to your server using SSH.

Step 2: Installation

To install PostgreSQL onto your CentOS 7, open your terminal and run the following command.

sudo yum install postgresql-server postgresql-contrib

The PostgreSQL installation will take some time to complete. The reason why it is this simple to install PostgreSQL is due to PostgreSQL being part of the CentOS 7 repository.

Step 3: Initialization

After completing the installation, use the following command to initialize it.

sudo postgresql-setup initdb

Step 4: Start PostgreSQL

Your PostgreSQL is ready to use by now, to start it, run the following command.

sudo systemctl start postgresql

Step 5: Enable PostgreSQL

This step is how to enable PostgreSQL to start on every system boot, which is completely optional and up to user preference. To enable it, run the following command.

sudo systemctl enable postgresql