0

I have spent quite a bit of time wrestling with this postgresql update, but I just can't quite get it configured correctly. I recently upgraded from 9.0 to 9.1, and I can't get Postgres 9.1 configured correctly.

I wanted it to start on start up, so I went and found the postgres file in etc/init.d and replaced it with the script that came with the source files (the linux script found in /contrib/start-scripts).

I only changed some of the stuff as follows:

# Installation prefix
prefix="/usr/local/pgsql"

# Data directory
PGDATA="/var/lib/postgresql/9.1/main"

# Who to run the postmaster as, usually "postgres".  (NOT "root")
PGUSER=postgres

# Where to keep a log file
PGLOG="/var/log/postgresql/9.1"

Then I installed and ran chkconfig --add postgresql. From what I could see, the rhN directories seemed to have been updated. But, unfortunately, Postgresqk didn't work, it does not start up, or at least, I don't think it starts up. Did I miss a step?

Also, when I run /usr/local/pgsql/bin/psql , the error says:

Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Whereas running the old server's psql command when it's not running gives:

Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

What is that domain socket directory, and do I need to change it?

So, how do I get it to start up, if it helps, I am running Ubuntu 10.04 LTS.

Lastly, I know it's bad etiquette to ask multiple questions, but I figured it would be rude to make another question for a small question like this: I also want to make it so that if I enter a postgres command (e.g. psql) into the terminal, it should run the new postgres command, not the old one like it does now. Where do I change this?

Thanks for all your help.

zermy
  • 157
  • 1
  • 7

1 Answers1

0

Then I installed and ran chkconfig --add postgresql

You need also turn on it:

chkconfig postgresql on

Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Did you start the postgresql?

$ ps -ef | grep postgre

What is that domain socket directory, and do I need to change it?

It contains the Unix domain socket which server is to listen for connections from the clients. You don't need to change (it can be done with unix_socket_directory).


Now, the problem is that, I still need to write out the full location of the directory when running a command. Hmm, how do I fix this.

Add it to the $PATH environment variable by inserting/appending the belows line to ~/.profile in your $HOME:

export PATH=$PATH:/usr/local/pgsql/bin

Make this take effect with:

$ source ~/.profile

or:

$ . ~/.profile

You can also add to /etc/profile for global usage.

quanta
  • 50,327
  • 19
  • 152
  • 213
  • Thanks a bunch, I didn't know you had to turn it on, I tried turning it on, but it didn't work, though it did give me these warnings: `insserv: warning: script 'K02postgresql' missing LSB tags and overrides`. Is the warning responsible for not making it work as well? – zermy Oct 14 '11 at 13:31
  • Why not use [sysv-rc-conf](http://manpages.ubuntu.com/manpages/hardy/man8/sysv-rc-conf.8.html) instead of installing `chkconfig` on Ubuntu. – quanta Oct 14 '11 at 13:37
  • Yup, I went ahead and used sysv-rc-conf,I don't know if I needed to use it or not, but I figured out some problems in the script thanks to it, like for example, not defining a name for the log. So, now it works! Now, the problem is that, I still need to write out the full location of the directory when running a command. Hmm, how do I fix this. – zermy Oct 14 '11 at 14:06
  • Updated my answer. – quanta Oct 14 '11 at 14:16
  • Thanks a lot,I managed to add the location to the `$PATH` variable, but, the old ones are still used, and this is because those files still exist in `/usr/bin`. So, I need to either delete or replace them, and as such, just one small question remains. Is it a better practice to place the postgres programs in `/usr/bin` (by replacing the old ones) or leave them in the install directory and simply delete the old ones? Thanks for everything. – zermy Oct 14 '11 at 15:52
  • You can remove the old version if you don't want to use it anymore. – quanta Oct 14 '11 at 15:55