This post focuses on how to install PostgreSQL Server PostgreSQL, usually known as Postgres, is an open-source, powerful object-oriented relational database. This is the first database management system intended for a UNIX-based environment. However, due to changes in its design over time, PostgreSQL can now run on a variety of operating systems, including Solaris, Mac OS X, and Windows. PostgreSQL is open-source software, with the source code available under the PostgreSQL license. PostgreSQL also has the following features:
- User-defined data types
- Table inheritance
- Sophisticated locking mechanism
- Foreign key referential integrity
- Views, rules, subquery
- Nested transactions (savepoints)
- Multi-version concurrency control (MVCC)
- Asynchronous replication
- PITR(Point-in-Time-Recovery) and reliability
How to Install PostgreSQL Server on Zorin OS
This article is going to explain how to install PostgreSQL server on your Zorin OS and take you through all the necessary installation steps to make sure you install it properly and successully.
Step 1: Update System Packages
Your system should up-to date because it is very likely that you won’t run into any problems.Use the commands below to bring your system up-to date.
$ sudo apt update $ sudo apt -y upgrade

Step 2: Install PostgreSQL Server on Zorin OS
We can install the default version of PostgreSQL Server available on Zorin without performing the Ubuntu repository configuration. Use the command below to install PostgreSQL Server on your Ubuntu based Zorin OS.
$ sudo apt install postgresql postgresql-client
During the installation, a prompt will appear on your screen asking you to confirm whether you wish to proceed with the installation or not. To proceed with the installation, press ‘y’.


Step 3 :Confirm whether PostgreSQL Server is running
The server automatically runs upon the installation but should that not be the case, use the commands below to start, stop and enable the server’s services.
$ sudo systemctl stop postgresql.service $ sudo systemctl start postgresql.service $ sudo systemctl enable postgresql.service
You can now verify that PostgreSQL Server is running on your system by executing the following command.
$ sudo systemctl status postgresql.service

Step 4: Updating PostgreSQL admin’s user password
A default password is set for the admin during the installation but we need to create a secure password for this admin user. You can change the password using the command below.
$ sudo passwd postgres

$ sudo su -l postgres $ psql

Step 5: Create database and user
You can create a database from the shell as follows;Use the commands below.
$ createuser dbusergidii $ createdb gidiidb -O dbusergidii $ psql gidiidb

$ psql -l

Step 6: Configure PostgreSQL Server for remote access
By default, this database server will only listen to local hosts; however, we can access it remotely by making certain changes to its configuration file. We can either limit its listening to a few IP addresses or open its channel to all the IP addresses. We can use the nano
command to be able to perform some changes to the configuration file.
$ sudo nano /etc/postgresql/13/main/postgresql.conf

listen_ addresses
in the Configuration file and remove the # in front of it. After that, replace localhost with a * sign to allow any IP address to connect to the Database server; however, if you want to confine it to a certain IP address, write it instead of ‘*’. Commas must be used to separate multiple addresses.To save the changes made to the file, type Ctrl + X,Y then hit the enter key.Change the host value as shown below.
$ host all all 0.0.0.0/0 md5 $ host all all ::0/0 md5

Type Ctrl + X,Y then hit the enter key to save the file.
To apply the changes, you need to restart the database server. Use the command below.
$ sudo systemctl restart postgresql
Conclusion
In this article, we looked at PostgreSQL Server as a database server used to manage databases. We have also gone through all the installation steps and installed it successfully. Database management services are required almost in every institution if not all, hence it might be a good idea to learn some basics. Check our other posts on Zorin OS such as;