Amazon-Ec2

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

  • March 1, 2020

在 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

幫助表示讚賞。

當我在 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

我想知道您是否啟用了正確的回購。如果這沒有幫助,請編輯您的問題以使用“yum repolist all”顯示您的回購列表。

如果您需要 Amazon Updates 儲存庫,請嘗試將其添加到文件 /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

引用自:https://serverfault.com/questions/1004936