Question: How do I know if PostgreSQL is running or installed on a Linux server ?
Answer: There are some ways to check whether PostgreSQL is running or installed, but it will depend on how PostgreSQL was installed . It pays to ask the user , how PostgreSQL was installed.
Some different methods of PostgreSQL installation & configuration could include:
-Installed from rpm packages and started by init script
-Installed running but the installation is not associated to the default PATH or even the default port
-Installed from rpm packages but not set to start
As a starter these are some methods to check the PostgreSQL installation .
1) If PostgreSQL is not installed and you which psql there is no output. You get the terminal prompt ready to accept a command.
If PostgreSQL is installed which psql will return the path
2)Another way of gathering some information is to execute psql –version, which will give you the PostgreSQL version. Being able to get some useful information using this method – will depend on whether PostgreSQL is on the PATH
3) If you want to know which actual port is used netstat is your friend.
sudo netstat -plunt |grep postgres
4)If all else fails you can use – find / -name ‘postgres’ or ps aux |grep postgres
Author: Jack Vamvas
Leave a Reply