2

I'm running on an AWS Ubuntu image.

In an attempt to set up my machine, I played around with apt-get to add and remove PostgreSql and some of its modules.

Now, when I run sudo apt-get install postgresql-9.3 i get the following error:

Setting up postgresql-9.3 (9.3.10-0ubuntu0.14.04) ... update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode * Starting PostgreSQL 9.3 database server * Error: could not exec /usr/lib/postgresql/9.3/bin/pg_ctl /usr/lib/postgresql/9.3/bin/pg_ctl start -D /var/lib/postgresql/9.3/main -s -o -c config_file="/etc/postgresql/9.3/main/postgresql.conf" : No such file or directory 

The only file/directory missing is /var/lib/postgresql/9.3/main

I tried:

  1. Adding the directory
  2. Removing postgresql with sudo apt-get remove postgresql-9.3 and installing it again

The error still occurs.

What am I doing wrong? How can I fix this?

1 Answer 1

2

My understanding is that you deleted the cluster when uninstalling and it isn't recreated automatically.

Recreating the cluster should solve the problem:

mkdir /var/lib/postgresql/9.3/main chown postgres /var/lib/postgresql/9.3/main su postgres /usr/lib/postgresql/9.3/bin/pg_ctl -D /var/lib/postgresql/9.3/main initdb 

You may need to substitute postgres with the database user account that is used on ubuntu.

Checkout the postgres manual for more information: http://www.postgresql.org/docs/current/static/creating-cluster.html

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.