The development of applications every day yields more and more fruits, but also more demanding. That’s why you need more and better database managers. There is a very good one like MariaDB, however, for big projects developers prefer PostgreSQL. Using PostgreSQL on a server with OpenSUSE or SUSE is a guarantee of success and reliability. Therefore, today I will teach you how to install PostgreSQL on OpenSUSE 15 / 15.1.
PostgreSQL is perhaps one of the best-known database managers in the world. However, there are people and developers who do not know it. So, in short, I will tell you that it is open source, quite secure and with great performance for data processing. It can run great queries in pretty good times and above all, it is easy to install on a server with Linux. In its standard library of functions, there are hundreds of functions implemented, from mathematical operations to operations with character strings.
So, let’s start to install PostgreSQL on OpenSUSE.
1. Upgrade the system
The first step to install PostgreSQL is to update the system. It is never good to have the obsolete packages of our system, it is to have security holes and that at the computer level is almost unacceptable.
:~$ sudo zypper up
Now that you have the system updated. Security patches are available on your Linux distribution. This way you will have a more secure system and ready to start.
2. Getting PostgreSQL on OpenSUSE 15 / 15.1
PostgreSQL comes in the official repositories of the distribution and its installation is quite simple. However, it is convenient to add your repository to always get the latest versions available.
So, let’s do it. If you are using OpenSUSE 15, run this command:
:~$ sudo zypper addrepo http://download.opensuse.org/repositories/server:database:postgresql/openSUSE_Leap_15.0/ PostgreSQL
If you are using OpenSUSE 15.1, run this command:
:~$ sudo zypper addrepo http://download.opensuse.org/repositories/server:database:postgresql/openSUSE_Leap_15.1/ PostgreSQL
Now, refresh repo cache.
:~$ sudo zypper refresh
Then, install the PostgreSQL packages:
:~$ sudo zypper in postgresql postgresql-server postgresql-contrib
This is enough, PostgreSQL is already installed but there are still other things to do.
Working with the PostgreSQL service
The next step is to start PostgreSQL. To do this, we’ll use the
systemctl command. First, start the service.
:~$ sudo systemctl start postgresql
If you want PostgreSQL to start with the system (recommended) then run this command:
:~$ sudo systemctl enable postgresql
Finally, you can check the status service:
:~$ sudo systemctl status postgresql
Create a new user for PostgreSQL on OpenSUSE
It is highly recommended to create an additional user other than the
postgres user to access the PostgreSQL console. For that reason, we are going to create a new user and give him superuser permissions and with him, you will be able to work without problems.
First, switch to the postgres user:
:~$ sudo su postgres
Next, enter the PostgreSQL interactive terminal:
Now, create the user.
CREATE ROLE your_user WITH PASSWORD 'your_password';
Finally, grant the role to the new user.
ALTER ROLE your_user WITH SUPERUSER;
Of course, I’m showing the syntax of the command in question, so you should replace the data with what you consider correct.
Now you can start to work with PostgreSQL.
As you can see, the installation is quite simple, but it opens up many powerful possibilities for you to use.
PostgreSQL in OpenSUSE gives guarantees of security and performance, as well as innovative programs.
Great job. Thank you very much.
Thanks for your comment.
I need change location default directory data. Do you have a how to?