This relational DBMS is free and open-source, contributing more to its wide usage within the different industrial sectors. Moreover, the kind of transactions that this DBMS deals with is ACID, i.e., it can efficiently perform the transactions with ACID properties (atomicity, consistency, isolation, and durability). It means that if you have the data with these properties and want to create a relational database for it, you should definitely consider using the PostgreSQL server.
Since the launch of this relational DBMS back in 1996, it has undergone several upgrades, which is why its functionality is comparable with any of the latest relational database management systems. Moreover, this DBMS also provides enhancements in the traditional database management systems’ features and perfect compliance with SQL. This relational DBMS supports a wide range of native data types and some user-defined data types. In addition to that, it also handles the different versions of your databases while maintaining their concurrency in an extremely graceful manner.
The concept of inheritance also works well with the tables created within the databases of this DBMS. It means that you can let a table inherit its parent table’s properties very conveniently while using the PostgreSQL server. Other than that, this DBMS also allows you to back up your data online, preventing any data losses. Moreover, it also supports point-in-time recovery for easier access to the recovered data. By now, we have sufficiently discussed the relevant features of the PostgreSQL server. Now, it is the right time to talk about the actual focus of this article.
This article intends to teach you the installation procedure of the PostgreSQL server on a Linux distribution, i.e., Ubuntu 20.04. You can also use any other Linux flavor of your choice if you wish so. However, the method shared below will work perfectly well with a Ubuntu 20.04 system.
Method of Getting started with PostgreSQL in Ubuntu 20.04:
For getting started with PostgreSQL on a Ubuntu 20.04 system, you need to perform the following steps in the specified order:
Step # 1: Get your System Ready for PostgreSQL Installation:
Before we install anything on any Linux distribution, it is highly recommended to have an updated system. This goal can be achieved with the help of the command stated below:
Step # 2: Run the Installation Command for PostgreSQL:
Once the above-mentioned command has finished its execution, the next step is to execute the following command in your Ubuntu 20.04 terminal:
This command will install PostgreSQL on our Ubuntu 20.04 system, which is mandatory for us, i.e., we will not be able to start it if it is not installed on our Ubuntu 20.04 system.
With this command, you will be able to install PostgreSQL on your system very conveniently, and this whole process will take a few minutes to complete; however, we already had it installed on our system. Therefore, we were presented with the message shown in the image below once we executed the command mentioned above on our Ubuntu 20.04 system:
However, once you are installing the PostgreSQL server on your Ubuntu 20.04 system (if it is not already installed on it), then during the installation, you will be asked once to confirm your action. Once you will do that, the installation process of the PostgreSQL server will continue on your Ubuntu 20.04 system, and it will terminate upon a successful installation hence displaying a success message on the terminal.
Step # 3: Verify the Active Status of PostgreSQL:
We also need to verify that the PostgreSQL server is active on our system. For that, we can check its status with the following command:
The output presented in the image shown below verifies that PostgreSQL is active on our system. However, a point to be noted over here is that this server is not running now. It will only run once we start this server. This is exactly why the status turned out to be “active (exited)” instead of “active (running)”.
Step # 4: Start PostgreSQL by Accessing its Server:
After verifying the status of the PostgreSQL server on our Ubuntu 20.04 system, we will access this server so that it can start running with the help of the following command:
Your PostgreSQL server will immediately start running on your Ubuntu 20.04 system as soon as this command is executed. You can confirm this by taking a look at the changed path on your system’s terminal.
Step # 5: Enter the PostgreSQL Console:
Finally, for playing around with the databases, we need to enter the PostgreSQL console, which can be done with the command shown below:
You can see the PostgreSQL console in the following image:
After entering this console, you can instantly start working with databases by executing different queries of your choice in this console.
As an additional tip, we would like to teach you how to go back to your normal terminal in Ubuntu 20.04. For that, you first need to exit from the PostgreSQL console, after which you will have to log out from the PostgreSQL server. This can be done by following the two tips shared below:
Tip # 1: How to Exit from the PostgreSQL Console?
For exiting from the PostgreSQL server’s console, you need to type “\q” in that console and press the Enter key as shown in the following image:
Once you will do that, you will be out of the PostgreSQL server’s console.
Tip # 2: How to Logout from the PostgreSQL Server?
Now for logging out of the PostgreSQL server, you need to run the command shown below:
When you run this command, you will be successfully logged out of the PostgreSQL server.
You can easily realize from this tutorial how simple it is to start PostgreSQL on a Linux system. We have used a Ubuntu 20.04 system for explaining this method. The main thing that you need to have is the PostgreSQL server installed on your system. If you have installed it on your system and its status is active, then it is just a matter of a few seconds for you to start this server on your system. Moreover, as an additional tip, we also taught you how to get out of the PostgreSQL server’s console and how to log out of this server.