pg_dump:如何在 Amazon Linux 上安装 PostgreSQL 9.5.2?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36881350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:15:34  来源:igfitidea点击:

pg_dump: how to install on Amazon Linux for PostgreSQL 9.5.2?

postgresqlamazon-ec2rds

提问by Amir Mehler

I used to install and do:

我曾经安装并执行:

$ sudo yum install -y postgresql94-server postgresql94
$ pg_dump -h name-of-db.us-east-1.rds.amazonaws.com -U user dbName > dump

After RDS upgrade to 9.5.2 I get this:

RDS 升级到 9.5.2 后,我得到了这个:

pg_dump: server version: 9.5.2; pg_dump version: 9.4.5
pg_dump: aborting because of server version mismatch

I can't find a proper package for Amazon Linux

我找不到适合 Amazon Linux 的软件包

This didn't help me: http://tecadmin.net/install-postgresql-9-5-on-centos/

这对我没有帮助:http: //tecadmin.net/install-postgresql-9-5-on-centos/

Can you?

你可以吗?

回答by Amir Mehler

Ok, found it.

好的,找到了。

(1) Install the repo:

(1) 安装仓库:

$ sudo rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-ami201503-95-9.5-3.noarch.rpm

- Update: 9.5.2-> 9.5.3 Found the repo here.

- 更新:9.5.2-> 9.5.3 在这里找到了 repo 。

(2) Then install the package:

(2) 然后安装包:

$ sudo yum install postgresql95

Now you can dump your RDS database to a near by ec2 instance!

现在您可以将 RDS 数据库转储到附近的 ec2 实例!

回答by postalservice14

You can actually install a newer version of Postgres with the Amazon Extras Library: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library

您实际上可以使用 Amazon Extras 库安装较新版本的 Postgres:https: //docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library

I needed Postgres 10, so for me the command was:

我需要 Postgres 10,所以对我来说命令是:

sudo amazon-linux-extras install postgresql10

You can view a list of extras Amazon Linux provides by using this command:

您可以使用以下命令查看 Amazon Linux 提供的附加功能列表:

amazon-linux-extras list