【问题标题】:Installing postgres on EC2 (Amazon Linux) [closed]在 EC2(Amazon Linux)上安装 postgres [关闭]
【发布时间】:2014-01-21 14:03:40
【问题描述】:

尝试安装 postgreSQL,看起来我搞砸了。我首先使用以下命令删除 postgres。

[ec2-user@ip-10-183-130-45 /]$ rm -rf /var/lib/pgsql/data
[ec2-user@ip-10-183-130-45 /]$ sudo rm -rf /var/pgsql

然后尝试initdb,由于某种原因失败了,

[ec2-user@ip-10-183-130-45 /]$ sudo service postgresql initdb
Initializing database:                                     [FAILED]

但是当我检查时,initdb 确实创建了 pgsql 文件夹,

[ec2-user@ip-10-183-130-45 var]$ ls -l
total 80
drwxr-xr-x  2 root     root     4096 May  9  2013 account
drwxr-xr-x  9 root     root     4096 Sep 18 09:54 cache
drwxr-xr-x  3 root     root     4096 May  9  2013 db
drwxr-xr-x  3 root     root     4096 May  9  2013 empty
drwxr-xr-x  3 root     root     4096 Nov  8 06:34 ftp
drwxr-xr-x  2 root     root     4096 Jan  6  2012 games
drwxr-xr-x 20 root     root     4096 Oct 14 07:34 lib
drwxr-xr-x  2 root     root     4096 Jan  6  2012 local
drwxrwxr-x  5 root     lock     4096 Jan 21 04:36 lock
drwxr-xr-x  7 root     root     4096 Jan 21 09:31 log
lrwxrwxrwx  1 root     root       10 May  9  2013 mail -> spool/mail
drwxr-xr-x  2 root     root     4096 Jan  6  2012 nis
drwxr-xr-x  2 root     root     4096 Jan  6  2012 opt
**drwx------  3 postgres postgres 4096 Jan 21 13:26 pgsql**
drwxr-xr-x  2 root     root     4096 Jan  6  2012 preserve
drwxr-xr-x  2 root     root     4096 Mar 14  2013 racoon
drwxr-xr-x 16 root     root     4096 Jan 21 13:23 run
drwxr-xr-x  9 root     root     4096 May  9  2013 spool
drwxrwxrwt  3 root     root     4096 Jan 20 06:00 tmp
drwxrwsr-x  7 root     www      4096 Nov 17 14:38 www
drwxr-xr-x  2 root     root     4096 Jan  6  2012 yp

所以我尝试启动 postgresql,它也失败了

[ec2-user@ip-10-183-130-45 var]$ sudo service postgresql start

/var/pgsql is missing. Use "service postgresql initdb" to initialize
the cluster first.
                                                           [FAILED]

有人可以帮忙,找出我做错了什么吗?使用 postgresql-9.2-1.19。

【问题讨论】:

  • 如果我记得你必须启动“service postgresql initdb”而不是 root 而是 postgres 用户
  • 快速提示:不要将 Amazon Linux 用于 PostgreSQL。除非有所改变,否则他们对 PostgreSQL 的打包是危险且无能的——他们默默地将您更新到新的主要版本,因此yum update 可能会导致您的数据库无法启动。见dba.stackexchange.com/q/28245/7788。使用 CentOS、Fedora、Ubuntu,除了 Amazon Linux for PostgreSQL。对于当前版本的软件包,请参阅 yum.postgresql.org 和 apt.postgresql.org
  • 但是……它真的很有帮助,为什么要关闭它?

标签: linux postgresql amazon-ec2 installation


【解决方案1】:

试试:

sudo yum remove postgresql postgresql-server
sudo rm -rf /var/lib/psql
sudo yum install postgresql postgresql-server

【讨论】:

  • 我试过这个,但我一直收到这个消息 - 加载的插件:优先级、更新-motd、升级-帮助程序 Repodata 已经超过 2 周了。安装 yum-cron?或者运行:yum makecache fast
【解决方案2】:

我认为有一个误解。你是不是说你删除了一些 postgres 文件,然后想知道为什么它不起作用?

我推荐:

  • 修复 postgres 的原始安装。
  • 优雅地删除它。也许是包管理器?
  • 使用包管理器安装新的 postgres。

【讨论】:

    猜你喜欢
    • 2011-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-16
    • 2018-09-09
    • 2018-05-06
    • 2017-09-22
    • 2020-01-07
    相关资源
    最近更新 更多