PostgreSQL is a powerful, open-source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads. PostgreSQL has earned a strong reputation for its proven architecture, reliability, data integrity, robust feature set, extensibility, and the dedication of the open-source community behind the software to deliver performant and innovative solutions consistently.
PostgreSQL comes with many features aimed to help developers build applications, administrators to protect data integrity and build fault-tolerant environments, and help you manage your data no matter how big or small the dataset. In addition to being free and open-source, PostgreSQL is highly extensible. For example, you can define your data types, build out custom functions, even write code from different programming languages without recompiling your database.
In this guide, we will explain how to install the latest version of PostgreSQL on a Debian 9 server.
Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can quickly deploy your cloud servers.
Once you have signed up, log into your Cloudwafer Client Area and deploy your Cloudwafer cloud server.
Updating System Packages
It is recommended that you update the system to the latest packages before beginning any major installations. Issue the command below:
sudo apt-get update && sudo apt-get upgrade
Step 1: Install PostgreSQL
Issue the commands below to install the PostgreSQL server and PostgreSQL contrib package which provides additional features for the PostgreSQL database using the command below:
sudo apt install postgresql postgresql-contrib
When prompted for confirmation, type y to proceed.
Step 2: Verifying Installation
After installation is completed, we can verify that there are no issues by connecting to the PostgreSQL database server using the
psql utility and print the server version:
sudo -u postgres psql -c "SELECT version();"
You can also check the status of the PostgreSQL service using the command below:
sudo systemctl status postgresql
To log in to the PostgreSQL server as the postgres user, switch to the user
postgres then access a PostgreSQL prompt using the
psql utility as shown below:
sudo su - postgres psql
To exit out of the PostgreSQL shell, type
You can also access the PostgreSQL prompt without switching users by using the
sudo command, as shown below:
sudo -u postgres psql
You can learn more about PostgreSQL by reading the official documentation