大网数据广告活动
服务器运维问答

postgresql installation failed with apt-get

· 52CE 我爱测

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 er…

问题原文

原帖链接 · 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:

  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?

已采纳解答

原帖链接 · 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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。