django - 将 Postgres11 部署到 Elastic Beanstalk - Requires/etc/redhat-release

标签 django postgresql amazon-web-services amazon-elastic-beanstalk

我在将我的第一个应用程序部署到 Elastic Beanstalk 时遇到了麻烦,我真的需要一些帮助。尽管 RDS 正式支持它,但我无法安装 Postgres11。

问题
如果我运行 eb deploy,我会收到消息说 pg_config executable not found。需要从源代码构建 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: ...

我想我需要添加 repo 协议(protocol)?很公平。接下来,我尝试添加我在互联网上其他帖子中找到的 repo 协议(protocol):

[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

从这里我卡住了我尝试了符号链接(symbolic link) /etc/system-release ->/etc/redhat-release没有运气。其他人似乎没有这个问题?出于某种原因,我似乎也没有梦寐以求的 amazon-linux-extras

环境

环境层:网络服务器
平台:在 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

最佳答案

或者,您可以从源代码构建 posgresql:

wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz

tar zxvf postgresql-11.5.tar.gz

cd postgresql-11.5

./configure --without-readline

制作

安装

关于django - 将 Postgres11 部署到 Elastic Beanstalk - Requires/etc/redhat-release,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55798856/

相关文章:

django - Celery + Redis - Django 在延迟触发任务时阻塞

python - 错误: No module named [filename]

python - Django:这种情况我该如何迁移呢?迁移不起作用

postgresql - 创建 Postgres/PostGIS 函数以根据空间查询更新表值

postgresql - 用户 "postgres"的密码不匹配

amazon-web-services - 如何在AWS Elasticsearch实例中存储 “comment”?

javascript - 如何将带有字符串数组的 FormData 属性从 React Client 发送到 Django + Django Rest Framework API

sql - PostgreSQL:选择一周中某一天、特定时区发生的行

amazon-web-services - AWS 上的 memcached-session-manager

amazon-web-services - 如何为 AWS 角色生成访问 key 和 secret key