【发布时间】:2019-09-11 21:49:33
【问题描述】:
我在将我的第一个应用程序部署到 Elastic Beanstalk 时非常开心,我真的需要一些帮助。尽管 RDS 正式支持 Postgres11,但我无法安装它。
问题
如果我运行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: ...
我想我需要添加存储库?很公平。接下来我尝试添加我在互联网上其他帖子中发现的 repo:
[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
【问题讨论】:
-
我注意到
os-release指定了ID_LIKE="rhel fedora"。我尝试使用 fedora rpm 并且发生了相同的结果 ->Requires: /etc/fedora-release -
我仍然很想知道我缺少什么,但为了继续前进,我已经恢复到 PostgreSQL 9.6,因为它在 EB/EC2 上很容易获得。
-
使用普通 Amazon Linux 2 AMI 时,您可以发出命令:amazon-linux-extras install postgresql10 以获取版本 10。
-
对于那些寻找 postgres 12 qiita.com/tmiki/items/00d22edc6a554f61bd04
标签: django postgresql amazon-web-services amazon-elastic-beanstalk