How to know PostgreSQL is running or installed

30 December,2019 by Jack Vamvas

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 (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to know PostgreSQL is running or installed


dba-ninja.com