Amazon Linux:yumm install php73 > “没有可用的 php73 包”

Amazon Linux:yumm install php73 > “没有可用的 php73 包”

在 Amazon EC2 Linux 服务器上,我运行了:

sudo su -
yum -y update
yum install -y php73

我收到错误No package php73 available

我已经能够安装httpd、、php&,php-mysql好的。

这是我的 yum 仓库列表:

[root@ip-172-31-1-175 httpd]# yum repolist all
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                          | 2.4 kB  00:00:00     
amzn2extra-docker                                                   | 1.3 kB  00:00:00     
amzn2extra-php7.3                                                   | 1.8 kB  00:00:00     
(1/2): amzn2extra-php7.3/2/x86_64/updateinfo                        |   69 B  00:00:00     
(2/2): amzn2extra-php7.3/2/x86_64/primary_db                        | 256 kB  00:00:00     
repo id                              repo name                              status
amzn2-core/2/x86_64                  Amazon Linux 2 core repository         enabled: 18,631
amzn2-core-debuginfo/2/x86_64        Amazon Linux 2 core repository - debug disabled
amzn2-core-source/2                  Amazon Linux 2 core repository - sourc disabled
amzn2extra-docker/2/x86_64           Amazon Extras repo for docker          enabled:     19
amzn2extra-docker-debuginfo/2/x86_64 Amazon Extras debuginfo repo for docke disabled
amzn2extra-docker-source/2           Amazon Extras source repo for docker   disabled
amzn2extra-php7.3/2/x86_64           Amazon Extras repo for php7.3          enabled:    305
amzn2extra-php7.3-debuginfo/2/x86_64 Amazon Extras debuginfo repo for php7. disabled
amzn2extra-php7.3-source/2           Amazon Extras source repo for php7.3   disabled
repolist: 18,955

我已经创建了/etc/yum.repos.d/amzn2-updates.repo,但是当我运行时yum install php73,收到错误:

已加载插件:extras_suggestions、langpacks、priorities、update-motd 无法检索镜像列表 http://repo.ap-southeast-2.amazonaws.com/2/updates/mirror.list错误为 14:HTTP 错误 403 - 禁止访问

其中一个配置的存储库失败(未知),yum 没有足够的缓存数据来继续。此时 yum 唯一能安全做的事情就是失败。有几种方法可以“修复”此问题:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

找不到 repo 的有效 baseurl:amzn-updates/2

这是我的/etc/yum.repos.d/amzn2-updates.repo

[amzn-updates]
name=amzn-updates-Base
mirrorlist=http://repo.$awsregion.$awsdomain/$releasever/updates/mirror.list
mirrorlist_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=1
retries=3
timeout=5
report_instanceid=yes

[amzn-updates-debuginfo]
name=amzn-updates-debuginfo
mirrorlist=http://repo.$awsregion.$awsdomain/$releasever/updates/debuginfo/mirror.list
mirrorlist_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=0
retries=3
timeout=5
report_instanceid=yes

[amzn-updates-source]
name=amzn-updates-source
mirrorlist=http://repo.$awsregion.$awsdomain/$releasever/updates/SRPMS/mirror.list
mirrorlist_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=0
retries=3
timeout=5
report_instanceid=yes

非常感谢您的帮助。

答案1

当我在 Amazon Linux v1 上运行安装程序时,我看到的是

sudo yum install php73
Loaded plugins: update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package php73.x86_64 0:7.3.14-1.23.amzn1 will be installed
--> Processing Dependency: php73-common(x86-64) = 7.3.14-1.23.amzn1 for package: php73-7.3.14-1.23.amzn1.x86_64
--> Processing Dependency: php73-cli(x86-64) = 7.3.14-1.23.amzn1 for package: php73-7.3.14-1.23.amzn1.x86_64
--> Processing Dependency: php73-common for package: php73-7.3.14-1.23.amzn1.x86_64
--> Running transaction check
---> Package php73-cli.x86_64 0:7.3.14-1.23.amzn1 will be installed
---> Package php73-common.x86_64 0:7.3.14-1.23.amzn1 will be installed
--> Processing Dependency: php73-xml(x86-64) = 7.3.14-1.23.amzn1 for package: php73-common-7.3.14-1.23.amzn1.x86_64
--> Processing Dependency: php73-process(x86-64) = 7.3.14-1.23.amzn1 for package: php73-common-7.3.14-1.23.amzn1.x86_64
--> Processing Dependency: php73-json(x86-64) for package: php73-common-7.3.14-1.23.amzn1.x86_64
--> Running transaction check
---> Package php73-json.x86_64 0:7.3.14-1.23.amzn1 will be installed
---> Package php73-process.x86_64 0:7.3.14-1.23.amzn1 will be installed
---> Package php73-xml.x86_64 0:7.3.14-1.23.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================
 Package                   Arch               Version                         Repository                Size
=============================================================================================================
Installing:
 php73                     x86_64             7.3.14-1.23.amzn1               amzn-updates             3.6 M
Installing for dependencies:
 php73-cli                 x86_64             7.3.14-1.23.amzn1               amzn-updates             5.1 M
 php73-common              x86_64             7.3.14-1.23.amzn1               amzn-updates             1.4 M
 php73-json                x86_64             7.3.14-1.23.amzn1               amzn-updates              82 k
 php73-process             x86_64             7.3.14-1.23.amzn1               amzn-updates              95 k
 php73-xml                 x86_64             7.3.14-1.23.amzn1               amzn-updates             322 k

Transaction Summary
=============================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 11 M
Installed size: 36 M
Is this ok [y/d/N]: n
Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2020-02-28.20-47.yUTifC.yumtx

以下是我可用的 yum 仓库

> yum repolist all
Loaded plugins: update-motd, upgrade-helper
repo id                                 repo name                                            status
amzn-main/latest                        amzn-main-Base                                       enabled: 5,933+1
amzn-main-debuginfo/latest              amzn-main-debuginfo                                  disabled
amzn-main-source/latest                 amzn-main-source                                     disabled
!amzn-nosrc/latest                      amzn-nosrc-Base                                      disabled
!amzn-preview/latest                    amzn-preview-Base                                    disabled
amzn-preview-debuginfo/latest           amzn-preview-debuginfo                               disabled
amzn-preview-source/latest              amzn-preview-source                                  disabled
amzn-updates/latest                     amzn-updates-Base                                    enabled: 3,774+2
amzn-updates-debuginfo/latest           amzn-updates-debuginfo                               disabled
amzn-updates-source/latest              amzn-updates-source                                  disabled
!copart-restic/x86_64                   Copr repo for restic owned by copart                 disabled
!devopsx-amazon/x86_64                  DevopsX packages for Amazon Linux - x86_64           disabled
!download.mono-project.com_repo_centos_ added from: http://download.mono-project.com/repo/ce disabled
!epel/x86_64                            Extra Packages for Enterprise Linux 6 - x86_64       disabled
epel-debuginfo/x86_64                   Extra Packages for Enterprise Linux 6 - x86_64 - Deb enabled:   2,958
epel-source/x86_64                      Extra Packages for Enterprise Linux 6 - x86_64 - Sou enabled:       0
epel-testing/x86_64                     Extra Packages for Enterprise Linux 6 - Testing - x8 disabled
epel-testing-debuginfo/x86_64           Extra Packages for Enterprise Linux 6 - Testing - x8 disabled
epel-testing-source/x86_64              Extra Packages for Enterprise Linux 6 - Testing - x8 disabled
repolist: 12,665

我想知道您是否启用了正确的 repo。如果这没有帮助,请编辑您的问题以使用“yum repolist all”显示您的 repo 列表。

如果您需要 Amazon Updates repo,请尝试将其添加到文件 /etc/yum.repos.d/amzn-updates.repo

[amzn-updates]
name=amzn-updates-Base
mirrorlist=http://repo.$awsregion.$awsdomain/$releasever/updates/mirror.list
mirrorlist_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=1
retries=3
timeout=5
report_instanceid=yes

[amzn-updates-debuginfo]
name=amzn-updates-debuginfo
mirrorlist=http://repo.$awsregion.$awsdomain/$releasever/updates/debuginfo/mirror.list
mirrorlist_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=0
retries=3
timeout=5
report_instanceid=yes

[amzn-updates-source]
name=amzn-updates-source
mirrorlist=http://repo.$awsregion.$awsdomain/$releasever/updates/SRPMS/mirror.list
mirrorlist_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=0
retries=3
timeout=5
report_instanceid=yes

相关内容