PostgreSQL is an open-source object-relational database server that runs on Client-Server architecture. It is one of the most popular database servers out there and many large projects prefer it over MariaDB.
High concurrency is present in PostgreSQL because it allows that while one process writes to a table, others can access the same table without blocking. In addition to this, PostgreSQL works on a per-process basis and a failure in one process will not affect the rest and the system will continue to run.
In addition to the many new features that the application has, we can also say that the Linux support is top-notch. Also, other management tools such as PgAdmin will help us to get the most out of an instance.
Install PostgreSQL on Debian 11
PostgreSQL is present in the official Debian 11 repositories so the installation process becomes easy to execute. In this sense, open a terminal or SSH session and once it has loaded, update the system
sudo apt update sudo apt upgrade
After this, you can install PostgreSQL version 13 as follows
sudo apt install postgresql-13
This will install the PostgreSQL server but we can also install a client that will allow us to make remote connections to other instances.
sudo apt install postgresql-client-13
With these two packages installed, we now have postgreSQL installed on the system.
Working with the PostgreSQL service
When the program is installed correctly, we can manage its service from the systemctl
command.
If you want to know the status of the service, run
sudo systemctl status postgresql
Then, you can start it as follows
sudo systemctl start postgresql
But sometimes you may want to stop the service, so run
sudo systemctl stop postgresql
And when you make a change in the PostgreSQL configuration you have to restart it so that the changes can be applied correctly.
sudo systemctl restart postgresql
By default, PostgreSQL is configured to start with the system. If you don’t want this to be the case you have to run
sudo systemctl disable postgresql
Or revert the changes
sudo systemctl enable postgresql
This way, you can manage the PostgreSQL service and thus manage the application’s execution.
Accessing the PostgreSQL console
During the installation of PostgreSQL, a new user named postgres
is created who is authorized to run psql
which is the PostgreSQL console.
So, to access the PostgreSQL console, you can run this command one at a time
sudo -u postgres psql
This will open the console. To exit, you have to run \q
or exit
just like that.
PostgreSQL will be installed and ready to store your application’s data.
Conclusion
Throughout this post, we have walked you through the process of installing PostgreSQL on Debian 11. This way a novice or an experienced user of this system can get the job done and start working with what for many is the best open source relational database manager out there.
So, tell us, what do you think about the post? did you like it? have you used PostgreSQL? leave us a comment and help us to grow