Cesty jsem přidal, ale stejně to nefunguje. Nicméně, mám pocit, že problém je stejně někde jinde.
Chápu ho tak, že se při instalaci vytvoří defaultní postgresql uživatel pomocí kterého lze databázi ovládat, jelikož se mu v rámci instalace přiřadí nějaká "role" a můj problém celou dobu spočívá spíše v tom, že potřebuji toho uživatele co má tu roli:
Správná situace:
[root@postgre ~]# sudo -i -u postgres
-bash-4.2$ psql
psql (9.2.24, server 9.5.14)
WARNING: psql version 9.2, server version 9.5.
Some psql features might not work.
Type "help" for help.
postgres=#
postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".
postgres=# \q
-bash-4.2$ env | grep PATH
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
-bash-4.2$
Moje špatná situace:
[root@postgresc2 ~]# sudo -i -u postgres
-bash-4.2$ psql
-bash: psql: command not found
-bash-4.2$ env | grep PATH
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
-bash-4.2$
Návod při běžné instalaci bez použití SC:
Using PostgreSQL Roles and Databases
By default, Postgres uses a concept called "roles" to aid in authentication and authorization. These are, in some ways, similar to regular Unix-style accounts, but Postgres does not distinguish between users and groups and instead prefers the more flexible term "role".
Upon installation Postgres is set up to use "ident" authentication, meaning that it associates Postgres roles with a matching Unix/Linux system account. If a Postgres role exists, it can be signed in by logging into the associated Linux system account.
The installation procedure created a user account called postgres that is associated with the default Postgres role. In order to use Postgres, we'll need to log into that account. You can do that by typing:
sudo -i -u postgres
You will be asked for your normal user password and then will be given a shell prompt for the postgres user.
You can get a Postgres prompt immediately by typing:
psql
You will be auto-logged in and will be able to interact with the database management system right away.
However, we're going to explain a little bit about how to use other roles and databases so that you have some flexibility as to which user and database you wish to work with.
Exit out of the PostgreSQL prompt by typing:
\q
You should now be back in the postgres user command prompt.
moje nastavení, které se vždy po odpojení od uživatele resetuje na defaultní(PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
):
[root@postgresc2 ~]# env | grep PATH
MANPATH=/opt/rh/rh-postgresql95/root/usr/share/man:
LIBRARY_PATH=/opt/rh/rh-postgresql95/root/usr/lib64
LD_LIBRARY_PATH=/opt/rh/rh-postgresql95/root/usr/lib64
CPATH=/opt/rh/rh-postgresql95/root/usr/include
PATH=/opt/rh/rh-postgresql95/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
PKG_CONFIG_PATH=/opt/rh/rh-postgresql95/root/usr/lib64/pkgconfig
[root@postgresc2 ~]# sudo -i -u postgres
-bash-4.2$ export PATH=/opt/rh/postgresql95/root/usr/bin${PATH:+:${PATH}}
-bash-4.2$ export LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64${LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-bash-4.2$ export LD_LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64${LD_LIBRARY-PATH:+:${LD_LIBRARY_PATH}}
-bash-4.2$ export MANPATH=/opt/rh/postgresql95/root/usr/share/man:${MANPATH}
-bash-4.2$ env | grep PATH
MANPATH=/opt/rh/postgresql95/root/usr/share/man:
LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64
LD_LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64PATH:+:
PATH=/opt/rh/postgresql95/root/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
-bash-4.2$ export LD_LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64
-bash-4.2$ env | grep PATH
MANPATH=/opt/rh/postgresql95/root/usr/share/man:
LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64
LD_LIBRARY_PATH=/opt/rh/postgresql95/root/usr/lib64
PATH=/opt/rh/postgresql95/root/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
-bash-4.2$ psql
-bash: psql: command not found
-bash-4.2$