How to install PostgreSQL and PhpPgAdmin on OpenSUSE leap 42.3

To install PostgreSQL and PhpPgAdmin on OpenSUSE leap 42.3

PostgreSQL is a powerful high-performance, object-relational database management system (ORDBMS). It is well suited for large databases and has quite large advanced features. It supports many OS that includes Linux, FreeBSD, Solaris and Microsoft Windows. And PhpPgAdmin is a PHP-based web application, used for managing PostgreSQL databases. It is easy to create a database, create a role and create tables in Postgres. In this tutorial, you will learn about the method to install PostgreSQL and PhpPgAdmin on OpenSUSE leap 42.3


Installing PostgreSQL

First, you need to install PostgreSQL by making use of the following command.

linuxhelp:~ # zypper in postgresql94 postgresql94-contrib postgresql94-server
Retrieving repository ' openSUSE-Leap-42.3-Update'  metadata .......................................................................................................................[done]
Building repository ' openSUSE-Leap-42.3-Update'  cache ............................................................................................................................[done]
Retrieving repository ' openSUSE-Leap-42.3-Update-Non-Oss'  metadata ...............................................................................................................[done]
Building repository ' openSUSE-Leap-42.3-Update-Non-Oss'  cache ....................................................................................................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 5 NEW packages are going to be installed:
  libpq5 postgresql-init postgresql94 postgresql94-contrib postgresql94-server
.
.
.
.
(2/5) Installing: libpq5-9.6.4-6.1.x86_64 ........................................................................................................................................[done]
(3/5) Installing: postgresql94-9.4.13-12.1.x86_64 ................................................................................................................................[done]
(4/5) Installing: postgresql94-server-9.4.13-12.1.x86_64 .........................................................................................................................[done]
(5/5) Installing: postgresql94-contrib-9.4.13-12.1.x86_64 ........................................................................................................................[done]

Once it is installed, you need to start and enable the PostgreSQL service.

linuxhelp:~ # systemctl start postgresql.service 

And then, you need to configure the default by making use of the following command.

linuxhelp:~ # su - postgres
postgres@www:~>  psql
psql (9.4.13)
Type " help"  for help.


Execute the following command to change the password for postgres.

 postgres=# passwd postgres
Invalid command passwd. Try ? for help.
postgres=# password postgres
Enter new password: 
Enter it again: 
postgres=# 
postgres=# q
Leave the postgres user to switch over as root user.
postgres@www:~>  exit
logout


Then create a new PostgreSQL User by making use of the following command.

linuxhelp:~ # su - postgres
postgres@www:~>  createuser -s nano
You can also create a database in the following manner. 
postgres@www:~>  createdb nano_db


Get into your PSQL terminal and give the password for the new user. Also, grant all the privileges.

postgres@www:~>  psql
psql (9.4.13)
Type " help"  for help.
postgres=# alter user nano with encrypted password ' 123'  
ALTER ROLE
postgres=# grant all privileges on database nano_db to nano 
GRANT
postgres=# q
postgres@www:~>  exit


Now, you need to check the configuration of PostgreSQL file. Open the .conf file as follows.

linuxhelp:~ # cd /var/lib/pgsql/
linuxhelp:/var/lib/pgsql # cd data/
linuxhelp:/var/lib/pgsql/data # vim postgresql.conf
Uncomment line 59, and make the following changes in the appropriate places. 
listen_addresses = ' *' 
port = 5432

Allow access by opening the pg_hba.conf file.

linuxhelp:/var/lib/pgsql/data # vim pg_hba.conf

Also once the changes are done, you shall restart the Postgresql service. And also check its status.

linuxhelp:/var/lib/pgsql/data # systemctl restart postgresql.service 
linuxhelp:/var/lib/pgsql/data # systemctl status postgresql.service 

Installing PHPPgAdmin

You shall now install phpPgAdmin by making use of the following command.

linuxhelp:/var/lib/pgsql/data # zypper in phpPgAdmin
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
  php7-pgsql phpPgAdmin
2 new packages to install.
Overall download size: 692.9 KiB. Already cached: 0 B. After the operation, additional 3.1 MiB will be
used.
Continue? [y/n/...? shows all options] (y): y
Retrieving package php7-pgsql-7.0.7-22.1.x86_64                    (1/2), 103.6 KiB (183.6 KiB unpacked)
Retrieving: php7-pgsql-7.0.7-22.1.x86_64.rpm .....................................................[done]
Retrieving package phpPgAdmin-5.1-10.1.noarch                      (2/2), 589.3 KiB (  2.9 MiB unpacked)
Retrieving: phpPgAdmin-5.1-10.1.noarch.rpm .......................................................[done]
Checking for file conflicts: .....................................................................[done]
(1/2) Installing: php7-pgsql-7.0.7-22.1.x86_64 ...................................................[done]
(2/2) Installing: phpPgAdmin-5.1-10.1.noarch .....................................................[done]

Once it is done, you shall open the phpPgAdmin configuration file.

linuxhelp:/var/lib/pgsql/data # cd /etc/phpPgAdmin/
linuxhelp:/etc/phpPgAdmin # vim config.inc.php 

You can now enable the PHP of your installed version.

linuxhelp:/etc/phpPgAdmin # a2enmod php7
linuxhelp:/etc/phpPgAdmin # a2enmod version


Again now, enable your PostgreSQL and Apache services.

linuxhelp:/etc/phpPgAdmin # systemctl restart postgresql
linuxhelp:/etc/phpPgAdmin # systemctl restart apache2

Now, go to the browser and give your domain as the URL. In the phpPgAdmin, choose the language and theme.

And then, enter the login credentials and proceed.


With this, the installation of both PostgreSQL and PhpPgAdmin on OpenSUSE leap 42.3 comes to an end.

FAQ
Q
what is the purpose of installing PostgreSQL and PhpPgAdmin on OpenSUSE?
A
PostgreSQL is a powerful high-performance, object-relational database management system (ORDBMS). It is well suited for large databases and has quite large advanced features. It supports many OS that includes Linux, FreeBSD, Solaris and Microsoft Windows. And PhpPgAdmin is a PHP-based web application, used for managing PostgreSQL databases.
Q
which command to install phpPgAdmin on open suse?
A
install phpPgAdmin by making use of the following command
# zypper in phpPgAdmin
Q
How to install pgadmin on Ubuntu?
A
use the below link to install pgadmin in ubuntu https://www.linuxhelp.com/how-to-install-pgadmin4-on-ubuntu-16-04/
Q
where to rectify the problem of "Login failed on phppgadmin"?
A
open php configuration file for rect/usr/share/phpPgAdmin/conf/config.inc.php .

do not open this one

/etc/phpPgAdmin/config.inc.php ... now change $conf['extraloginsecurity'] = true;

into $conf['e
Q
How to install the PostgreSQL and PhpPgAdmin in FreeDSD?
A
use the below link to install the PostgreSQL and PhpPgAdmin in FreeDSD
"https://www.linuxhelp.com/how-to-install-phppgadmin-in-freebsd/"