问题原文
原帖链接 · summerbulb · CC BY-SA 3.0
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:
- Adding the directory
- Removing postgresql with
sudo apt-get remove postgresql-9.3and installing it again
The error still occurs.
What am I doing wrong? How can I fix this?
已采纳解答
原帖链接 · Alexander Theißen · CC BY-SA 3.0
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
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
