Postgresql 8.4 on Ubuntu - PG_VERSION is missing

I want to get PostgreSQL 8.4 running on Ubuntu 10.10 (64bit desktop). I've installed postgres via Synaptic, tried to get it configured, but I can't get it working.

When I run this command:

./pg_ctl start -D /usr/share/postgresql/8.4/DATA

I get this error message:

FATAL: "/usr/share/postgresql/8.4/DATA" is not a valid data directory
DETAIL: File "/usr/share/postgresql/8.4/DATA/PG_VERSION" is missing.

The directory /usr/share/postgresql/8.4/DATA exists with owner postgres, but there is no PG_VERSION file in it.

How can I get Postgres working?
LVL 13
Who is Participating?
earth man2Commented:
run initdb ?
R7AFAuthor Commented:
Thanks. I can run it in the terminal now, but after a restart it doesn't run.

In /etc/rc2.d I see the following two symlinks. I thought this would make postgresql run at startup. Do I need to do something else?

lrwxrwxrwx   1 root root    20 2010-10-14 12:59 S19postgresql -> ../init.d/postgresql
lrwxrwxrwx   1 root root    24 2010-05-25 16:42 S19postgresql-8.4 -> ../init.d/postgresql-8.4
earth man2Commented:
# as root
chkconfig postgresql on

# will set service postgresql to start automatically on reboot

# the command
service postgresql start
# will manually start the postgresql service
R7AFAuthor Commented:
I installed chkconfig and ran the command. After a restart, postgres didn't run. When I use the command "service postgresql start", nothing happens, not even a comment or error message.

Postgresql does start when I use the following command.

/usr/lib/postgresql/8.4/bin/postgres -D /usr/share/postgresql/8.4/DATA
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.