I want to learn PostgreSQL and would like to use PgAdmin as the GUI. With a technical book to go along, I inevitably made some mistakes and have tried first removing PostgreSQL.
linux-3ztp:/home/by79 # zypper rm "postgres*"
and then try re-installing it.
zypper in -f postgresql postgresql10 postgresql10-contrib postgresql10-docs postgresql10-pgagent postgresql10-plperl postgresql10-plr postgresql10-plr-doc postgresql10-server postgresql10-test postgresql-contrib postgresql-docs postgresql-plperl postgresql-server postgresql-test
Loading repository data...
Reading installed packages...
Forcing installation of 'postgresql-10-lp151.6.6.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-10.12-lp151.2.9.1.x86_64' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql-server-10-lp151.6.6.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-server-10.12-lp151.2.9.1.x86_64' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql-docs-10-lp151.6.6.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-contrib-10.12-lp151.2.9.1.x86_64' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-docs-10.12-lp151.2.9.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-plperl-10.12-lp151.2.9.1.x86_64' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-plr-8.3.0.17-lp151.3.3.x86_64' from repository 'openSUSE-Leap-15.1-Oss'.
Forcing installation of 'postgresql-contrib-10-lp151.6.6.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql-plperl-10-lp151.6.6.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql-test-10-lp151.6.6.1.noarch' from repository 'openSUSE-Leap-15.1-Update'.
Forcing installation of 'postgresql10-pgagent-4.0.0-lp151.1.2.x86_64' from repository 'openSUSE-Leap-15.1-Oss'.
Forcing installation of 'postgresql10-plr-doc-8.3.0.17-lp151.3.3.x86_64' from repository 'openSUSE-Leap-15.1-Oss'.
Forcing installation of 'postgresql10-test-10.12-lp151.2.9.1.x86_64' from repository 'openSUSE-Leap-15.1-Update'.
Resolving package dependencies...
The following 15 packages are going to be reinstalled:
postgresql postgresql10 postgresql10-contrib postgresql10-docs postgresql10-pgagent postgresql10-plperl postgresql10-plr postgresql10-plr-doc postgresql10-server postgresql10-test postgresql-contrib postgresql-docs postgresql-plperl postgresql-server postgresql-test
15 packages to reinstall.
Overall download size: 9.8 MiB. Already cached: 0 B. No additional space will be used or freed after the operation.
Continue? [y/n/v/...? shows all options] (y): y
It goes on to retrieve and install the files, and looks to be running (at least the server part):
linux-3ztp:/home/by79 # systemctl start postgresql
linux-3ztp:/home/by79 # systemctl status postgresql
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2020-07-18 15:15:07 +08; 6s ago
Process: 30638 ExecStart=/usr/share/postgresql/postgresql-script start (code=exited, status=0/SUCCESS)
Main PID: 30647 (postgres)
Tasks: 8
CGroup: /system.slice/postgresql.service
├─30647 /usr/lib/postgresql10/bin/postgres -D /var/lib/pgsql/data
├─30648 postgres: logger process
├─30650 postgres: checkpointer process
├─30651 postgres: writer process
├─30652 postgres: wal writer process
├─30653 postgres: autovacuum launcher process
├─30654 postgres: stats collector process
└─30655 postgres: bgworker: logical replication launcher
Jul 18 15:15:07 linux-3ztp.suse systemd[1]: Starting PostgreSQL database server...
Jul 18 15:15:07 linux-3ztp.suse postgresql-script[30638]: 2020-07-18 15:15:07.797 +08 [30647]LOG: listening on IPv6 address "::1", port 5432
Jul 18 15:15:07 linux-3ztp.suse postgresql-script[30638]: 2020-07-18 15:15:07.797 +08 [30647]LOG: listening on IPv4 address "127.0.0.1", port 5432
Jul 18 15:15:07 linux-3ztp.suse postgresql-script[30638]: 2020-07-18 15:15:07.800 +08 [30647]LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Jul 18 15:15:07 linux-3ztp.suse postgresql-script[30638]: 2020-07-18 15:15:07.804 +08 [30647]LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Jul 18 15:15:07 linux-3ztp.suse postgresql-script[30638]: 2020-07-18 15:15:07.809 +08 [30647]LOG: redirecting log output to logging collector process
Jul 18 15:15:07 linux-3ztp.suse postgresql-script[30638]: 2020-07-18 15:15:07.809 +08 [30647]HINT: Future log output will appear in directory "log".
Jul 18 15:15:07 linux-3ztp.suse systemd[1]: Started PostgreSQL database server.
linux-3ztp:/home/by79 #
I guess the next step is to set up the psql and the pgadmin. For the psql, I was having the exact problem as
https://forums.opensuse.org/showthread.php/539617-Postgresql-configuration?highlight=postgresql
, so I follow the instruction to go:
https://en.opensuse.org/SDB:PostgreSQL
to eventually get:
linux-3ztp:/home/by79 # su - postgres
postgres@linux-3ztp:~> psql
psql (10.12)
Type "help" for help.
which works quite different from the below code as shown in the book and some other online sources:
$sudo - u postgres psql
but ok, I guess it works.
I have also changed the method from “peer” to “trust”, only for “local” in the pg_hba.conf file:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
Similarly for pgadmin, I remove
linux-3ztp:/home/by79 # zypper rm "pgadmin*"
and reinstall.
linux-3ztp:/home/by79 # zypper in -f pgadmin4 pgadmin4-doc pgadmin4-web
Loading repository data...
Reading installed packages...
Forcing installation of 'pgadmin4-4.1-lp151.1.2.x86_64' from repository 'openSUSE-Leap-15.1-Oss'.
Forcing installation of 'pgadmin4-doc-4.1-lp151.1.2.noarch' from repository 'openSUSE-Leap-15.1-Oss'.
Forcing installation of 'pgadmin4-web-4.1-lp151.1.2.noarch' from repository 'openSUSE-Leap-15.1-Oss'.
Resolving package dependencies...
The following 3 NEW packages are going to be installed:
pgadmin4 pgadmin4-doc pgadmin4-web
3 new packages to install.
Overall download size: 27.8 MiB. Already cached: 0 B. After the operation, additional 50.1 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package pgadmin4-doc-4.1-lp151.1.2.noarch (1/3), 23.8 MiB ( 25.8 MiB unpacked)
Retrieving: pgadmin4-doc-4.1-lp151.1.2.noarch.rpm ................................................................................................................................................................................................................[done (7.3 MiB/s)]
Retrieving package pgadmin4-web-4.1-lp151.1.2.noarch (2/3), 3.7 MiB ( 23.9 MiB unpacked)
Retrieving: pgadmin4-web-4.1-lp151.1.2.noarch.rpm ................................................................................................................................................................................................................[done (7.3 MiB/s)]
Retrieving package pgadmin4-4.1-lp151.1.2.x86_64 (3/3), 276.8 KiB (399.5 KiB unpacked)
Retrieving: pgadmin4-4.1-lp151.1.2.x86_64.rpm ....................................................................................................................................................................................................................[done (2.0 MiB/s)]
Checking for file conflicts: .................................................................................................................................................................................................................................................[done]
(1/3) Installing: pgadmin4-doc-4.1-lp151.1.2.noarch ..........................................................................................................................................................................................................................[done]
(2/3) Installing: pgadmin4-web-4.1-lp151.1.2.noarch ..........................................................................................................................................................................................................................[done]
(3/3) Installing: pgadmin4-4.1-lp151.1.2.x86_64 ..............................................................................................................................................................................................................................[done]
However, I have the below “fatal error” when I click on the PgAdmin icon in GNOME:
An error occurred initialising the application server:
Failed to launch the application server, server thread exiting.
Reading some online resources, I am guessing that this arises because there has been a previous installation. In the subsequent configuration window, it states
Python Path: /usr/lib64/python3.6/site-packages;/usr/lib/python3.6/site-packages
Application Path: //usr/lib/python3.6/site-packages/pgadmin4-web/
How to make pgadmin work? Would appreciate any suggestion. Thank you.