I am a newbie here and to the server administration. A couple of days back I have registered a server with Hetzner with Ubuntu 11.04.

I intend to work with PostgreSQL, for which I have installed from source after failing to install using apt-get. The installation as such doesn't fail, but the PostgreSQl service doesn't start automatically or when I try to start it manually. It fails with the following error message when I try to do anything with it:

manager@Ubuntu-1104-natty-32-minimal:~$ sudo su postgres -c psql template1
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

This was the error I was getting when I had installed PostgreSQL using apt-get and I re-installed it from source. The following is the output I got when I installed it from source. This confirms that the PostgreSQL is indeed installed.

make -C config install
make[1]: Entering directory `/home/manager/postgresql-9.0.4/config'
/bin/mkdir -p '/usr/local/pgsql/lib/pgxs/config'
/bin/sh ../config/install-sh -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh'
make[1]: Leaving directory `/home/manager/postgresql-9.0.4/config'
PostgreSQL installation complete.

But, doesn't the service starts automatically? It doesn't here:

manager@Ubuntu-1104-natty-32-minimal:~$ ps auxw | grep post
manager   6734  0.0  0.0   4156   868 pts/0    S+   14:10   0:00 grep --color=auto post

This is taking a toll on my patience and confidence. Please help me solve this problem.

link|improve this question
feedback

4 Answers

up vote 5 down vote accepted

Answering my own question. This is kinda annoying, the first question on any StackExchange site doesn't go well for me.

I had already done this, but somehow worked this time. Did this:

  1. sudo apt-get update && sudo apt-get upgrade
  2. sudo apt-get purge postgresql
  3. sudo apt-get -f install
  4. sudo apt-get install postgresql

Works like a charm.

link|improve this answer
feedback

I too faced this problem with Hetzner and very annoying. Here is how I solved it Tip: Looked at some pg package scripts

sudo apt-get purge postgresql* # ending * is important

sudo apt-get install postgresql

I suspect either Hetzner's 11.04 image is buggy or it's Ubuntu's .deb (unlikely though).

link|improve this answer
feedback

I have not seen this error on launchpad in associtiation with Natty. The same issue has been raised as a bug on launchpad for Hardy and got a fix. So following that logic I would expect it to be a bug and it is probably best practice to file a bug on launchpad.

Looking further into it I found 2 interesting (yet old) topics showing the exact same error that seem worth looking into:

This topic from 2006 is talking about the exact same problem and claims that

sudo /etc/init.d/postgresql-8.1 stop

sudo /etc/init.d/postgresql-8.1 start

psql template1

works.

On ubuntuforums there is a topic from 2008 about the same error and has a status 'solved'. Please have a look at the many suggestions in that topic.

link|improve this answer
thanks for the help. I really appreciate it. – Syed Aslam May 11 '11 at 15:54
feedback

psql is the cli client, it does not start the PostgreSQL server. To start the server, you should use:

/etc/init.d/postgresql start

then you can connect to it using psql.

To have PostgreSQL start on boot, you should do the following:

update-rc.d postgresql enable

You might also take a look at this:

http://www.cyberciti.biz/tips/how-to-controlling-access-to-linux-services.html

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.