Reputation: 13672
I have installed Postgresql in Ubuntu 16.10 in this path /opt/PostgreSQL/9.6
Now if I directly invoke /opt/PostgreSQL/9.6/bin/psql
it works fine and prompting for password as below
root@neo-linux /u/l/bin# /opt/PostgreSQL/9.6/bin/psql -d postgres -U postgres
Password for user postgres:
Now I've configured psql
as a softlink in /usr/local/bin
as below
lrwxrwxrwx 1 root root 28 Oct 31 17:57 psql -> /opt/PostgreSQL/9.6/bin/psql*
When I simply call psql
it's throwing the below error message.
root@neo-linux /u/l/bin# psql
/usr/local/bin/psql: line 24: /usr/local/bin/psql.bin: No such file or directory
Here is the content of /opt/PostgreSQL/9.6
root@neo-linux /u/l/bin# cat psql
#!/bin/bash
# If there's an OS supplied version of libreadline, try to make use of it,
# as it's more reliable than libedit, which we link with.
PLL=""
if [ -f /lib64/libreadline.so.6 ];
then
PLL=/lib64/libreadline.so.6
elif [ -f /lib64/libreadline.so.5 ];
then
PLL=$PLL:/lib64/libreadline.so.5
elif [ -f /lib/libreadline.so.6 ];
then
PLL=$PLL:/lib/libreadline.so.6
elif [ -f /lib/libreadline.so.5 ];
then
PLL=$PLL:/lib/libreadline.so.5
fi
# Get the PG bin directory path relative to psql caller script.
PG_BIN_PATH=`dirname "$0"`
if [ -z "$PLL" ];
then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PG_BIN_PATH/../lib "$PG_BIN_PATH/psql.bin" "$@"
else
LD_PRELOAD=$PLL LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PG_BIN_PATH/../lib "$PG_BIN_PATH/psql.bin" "$@"
fi
What am I missing?
Upvotes: 1
Views: 3787
Reputation: 248215
The problem is that it looks for another file in the same directory, but that isn't there. You could create a symbolic link to psql.bin
too, but why not set the PATH
correctly:
export PATH=$PATH:/opt/PostgreSQL/9.6/bin
If your problem is the version number, you could do this:
ln -s /opt/PostgreSQL/9.6 /opt/PostgreSQL/current
export PATH=$PATH:/opt/PostgreSQL/current/bin
Upvotes: 2