15 C
Texas
angeloma
Senior Writer and partner

How to install PostgreSQL on OpenSUSE 15 / 15.1?

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.

- Advertisement -
:~$ sudo zypper up

1.- Upgrade the system
1.- Upgrade the system

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

2.- Adding the repository
2.- Adding the repository

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

3.- Refreshing the repositoy
3.- Refreshing the repositories

Then, install the PostgreSQL packages:

:~$ sudo zypper in postgresql postgresql-server postgresql-contrib

4.- Install PostgreSQL on OpenSUSE
4.- Install PostgreSQL on OpenSUSE

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

5.- Working with the service
5.- Working with the service

Finally, you can check the status service:

:~$ sudo systemctl status postgresql

6.- Check the service
6.- Check the service

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

7.- Access to the postgres user
7.- Access to the postgres user

Next, enter the PostgreSQL interactive terminal:

:~$ psql

Now, create the user.

CREATE ROLE your_user WITH PASSWORD 'your_password';

8.- Creating the new user for postgreSQL on OpenSUSE
8.- Creating the new user for PostgreSQL on OpenSUSE

Finally, grant the role to the new user.

ALTER ROLE your_user WITH SUPERUSER;

9.- Assign permission to the user for PostgreSQL on OpenSUSE
9.- Assign permission to the user for PostgreSQL on OpenSUSE

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.

Conclusion

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article