Wesbytes Knowledge Base

Search our articles or browse by category below

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

Last modified: June 19, 2022
You are here:
Estimated reading time: 1 min
Linux VPS Server

PostgreSQL is an open-source relational database management system that is utilised on a variety of platforms and virtual private servers. PostgreSQL use SQL for relational queries and JSON for non-relational queries. If you need a database management system, PostgreSQL is a scalable and reliable database management system with powerful optimization tools that would be an excellent addition to your Linux VPS server. We will show you how to install PostgreSQL on your server in this article. CentOS 7 is the Linux distribution used in this tutorial.

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
Was this article helpful?
Dislike 0
Views: 21