将Postgres11部署到Elastic Beanstalk - 需要/ etc / redhat-release

问题描述 投票:3回答:3

我有一段时间将我的第一个应用程序部署到Elastic Beanstalk并且可以真正使用一些帮助。我无法安装Postgres11虽然RDS正式支持它。

问题 如果我运行eb deploy,我会收到消息,说找不到pg_config可执行文件。需要从源代码构建psycopg2

/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
  warnings.warn(msg)
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found.

pg_config is required to build psycopg2 from source.  Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option: ...

我想我需要添加回购?很公平。接下来我尝试添加我在互联网上的其他帖子中找到的回购:

[ec2-user@ip-... etc]$ sudo yum -y install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
Loaded plugins: priorities, update-motd, upgrade-helper
pgdg-centos11-11-2.noarch.rpm                                          | 5.6 kB  00:00:00     
Examining /var/tmp/yum-root-cQJP_4/pgdg-centos11-11-2.noarch.rpm: pgdg-redhat-repo-42.0-4.noarch
Marking /var/tmp/yum-root-cQJP_4/pgdg-centos11-11-2.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-4 will be installed
--> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-4.noarch
--> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-4.noarch
--> Finished Dependency Resolution
Error: Package: pgdg-redhat-repo-42.0-4.noarch (/pgdg-centos11-11-2.noarch)
           Requires: /etc/redhat-release

从这里我被困住了。我试过没有运气的符号化/etc/system-release -> /etc/redhat-release。似乎没有其他人有这个问题?出于某种原因,我似乎也没有令人垂涎的amazon-linux-extras

环境

环境层:Web服务器 平台:在64位Amazon Linux / 2.8.2上运行的Python 3.6


.ebextensions / packages.config

packages:
  yum:
    postgresql11-devel: []

requirements.txt

Django==2.2
psycopg2==2.8.2
pytz==2019.1
sqlparse==0.3.0

[ec2-user@ip-... etc]$ cat /etc/os-release 
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

[ec2-user@ip-... etc]$ cat /etc/system-release 
Amazon Linux AMI release 2018.03
django postgresql amazon-web-services amazon-elastic-beanstalk
3个回答
4
投票

对于AWS Elastic Beanstalk上的Django 2.1项目,PostgreSQL 10也存在同样的问题。

这个问题是在2019年4月17日左右推出的,以确保操作系统是一个真正的Red Hat版本(Amazon Linux不是)。我在PostgreSQL邮件列表中找到了一些细节:

“实际上,多年前就删除了亚马逊Linux支持。我只是确保我们的repo文件反映了这一点。” (BUG #15768: Removed rpms and now require /etc/redhat-release

邮件列表上的一张海报提出了以下修复:

“我们通过使用rpm并明确忽略存储库依赖关系暂时缓解了这个问题,但这似乎是对真正问题的创可贴修复,即依赖不应该存在。”

就个人而言,我和你一样,Scott,我只是简单地回到了AWS直接提供的PostgreSQL 9.6客户端软件包。只要Django和psycopg支持该版本,这个工作正常。

但是,长期解决方案是AWS最终为Amazon Linux 2提供平台...


1
投票

PostgreSQL 11尚未从亚马逊获得,但PostgreSQL 10是。我正在使用cat /etc/system-release报道的Amazon Linux第2版(Karoo)。要启用安装:

$ sudo amazon-linux-extras enable postgresql10

启用此额外功能后,您将看到许多可通过yum正常安装的PostgreSQL 10软件包:

$ yum list postgresql*
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
postgresql.x86_64                    10.4-5.amzn2.0.2    @amzn2extra-postgresql10
postgresql-devel.x86_64              10.4-5.amzn2.0.2    @amzn2extra-postgresql10
postgresql-libs.x86_64               10.4-5.amzn2.0.2    @amzn2extra-postgresql10
Available Packages
postgresql-contrib.x86_64            10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-docs.x86_64               10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-libs.i686                 10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-plperl.x86_64             10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-plpython.x86_64           10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-plpython3.x86_64          10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-pltcl.x86_64              10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-server.x86_64             10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-static.x86_64             10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-test.x86_64               10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-test-rpm-macros.x86_64    10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-upgrade.x86_64            10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-upgrade-devel.x86_64      10.4-5.amzn2.0.2    amzn2extra-postgresql10

0
投票

这是我最新的Amazon Linux 2 ami的特立独行解决方案:

sudo su
cd /etc/yum.repos.d
nano pgdg.repo

然后我用新创建的pgdg.repo文件将其粘贴到nano编辑器中:

[pgdg11]
name=PostgreSQL 11 $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7.5-x86_64
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-11

进一步的命令是:

sed -i "s/rhel-\$releasever-\$basearch/rhel-7.5-x86_64/g" "/etc/yum.repos.d/pgdg.repo"
yum groupinstall "PostgreSQL Database Server 11 PGDG"

创建一个新的PostgreSQL数据库集群:

/usr/pgsql-11/bin/postgresql-11-setup initdb

现在执行以下命令启动并启用postgresql服务:

systemctl enable postgresql-11
systemctl start postgresql-11

不过,请记住这个地址的注释:Link to Postgresql.org

© www.soinside.com 2019 - 2024. All rights reserved.