Opensuse

openSUSE - 儲存庫 ‘XY’ 無效 - 將儲存庫更改為從 Internet 載入,而不是從介質載入

  • December 20, 2019

我嘗試安裝一些 PHP 模組:

zypper install php7.0-gd php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-openssl php7.0-zip php7.0-soap

輸出:

Failed to mount cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001 on /var/tmp/AP_0xgQO1rM: Mounting media failed (mount: /var/tmp/AP_0xgQO1rM: no medium found on /dev/sr0.)
Please insert medium [] #1 and type 'y' to continue or 'n' to cancel the operation. [yes/no] (no): no
Error building the cache:
[openSUSE-Leap-15.0-1|cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001] Valid metadata not found at specified URL
Warning: Skipping repository 'openSUSE-Leap-15.0-1' because of the above error.
Some of the repositories have not been refreshed because of an error.
Loading repository data...
Reading installed packages...
'php7.0-curl' not found in package names. Trying capabilities.
No provider of 'php7.0-curl' found.
'php7.0-gd' not found in package names. Trying capabilities.
No provider of 'php7.0-gd' found.
'php7.0-intl' not found in package names. Trying capabilities.
No provider of 'php7.0-intl' found.
'php7.0-mbstring' not found in package names. Trying capabilities.
No provider of 'php7.0-mbstring' found.
'php7.0-mcrypt' not found in package names. Trying capabilities.
No provider of 'php7.0-mcrypt' found.
'php7.0-openssl' not found in package names. Trying capabilities.
No provider of 'php7.0-openssl' found.
'php7.0-soap' not found in package names. Trying capabilities.
No provider of 'php7.0-soap' found.
'php7.0-xsl' not found in package names. Trying capabilities.
No provider of 'php7.0-xsl' found.
'php7.0-zip' not found in package names. Trying capabilities.
No provider of 'php7.0-zip' found.
Resolving package dependencies...

Nothing to do.

我認為我的儲存庫有問題。它嘗試從磁碟(cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_100000000000000000001)而不是從 Internet 載入儲存庫。但是光碟不再插入,我不能,因為它是我公司的虛擬機,並且管理員正在休假。

zypper lr -uP

#  | Alias                     | Name                                    | Enabled | GPG Check | Refresh | Priority | URI
---+---------------------------+-----------------------------------------+---------+-----------+---------+----------+---------------------------------------------------------------------------------------
1 | openSUSE-Leap-15.0-1      | openSUSE-Leap-15.0-1                    | Yes     | ( p) Yes  | No      |   99     | cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001
2 | packman.inode.at-suse     | Packman Repository                      | Yes     | (r ) Yes  | Yes     |   99     | http://packman.inode.at/suse/openSUSE_Leap_15.0/
3 | repo-debug                | openSUSE-Leap-15.0-Debug                | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/distribution/leap/15.0/repo/oss/
4 | repo-debug-non-oss        | openSUSE-Leap-15.0-Debug-Non-Oss        | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/distribution/leap/15.0/repo/non-oss/
5 | repo-debug-update         | openSUSE-Leap-15.0-Update-Debug         | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/update/leap/15.0/oss/
6 | repo-debug-update-non-oss | openSUSE-Leap-15.0-Update-Debug-Non-Oss | No      | ----      | ----    |   99     | http://download.opensuse.org/debug/update/leap/15.0/non-oss/
7 | repo-non-oss              | openSUSE-Leap-15.0-Non-Oss              | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/distribution/leap/15.0/repo/non-oss/
8 | repo-oss                  | openSUSE-Leap-15.0-Oss                  | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/distribution/leap/15.0/repo/oss/
9 | repo-source               | openSUSE-Leap-15.0-Source               | No      | ----      | ----    |   99     | http://download.opensuse.org/source/distribution/leap/15.0/repo/oss/
10 | repo-source-non-oss       | openSUSE-Leap-15.0-Source-Non-Oss       | No      | ----      | ----    |   99     | http://download.opensuse.org/source/distribution/leap/15.0/repo/non-oss/
11 | repo-update               | openSUSE-Leap-15.0-Update               | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/update/leap/15.0/oss/
12 | repo-update-non-oss       | openSUSE-Leap-15.0-Update-Non-Oss       | Yes     | (r ) Yes  | Yes     |   99     | http://download.opensuse.org/update/leap/15.0/non-oss/

如何更改儲存庫以便從 Internet 載入?

我知道我可以使用 修改現有的 repo zypper modifyrepo,但是如何修改 URI 以及在哪裡可以找到正確的 URI?

似乎無法重命名 URI。

所以我刪除了舊的儲存庫zypper rr openSUSE-Leap-15.0-1並創建了新的儲存庫 - 我創建了 oss 和 non-oss,但我不確定 oss 和 non-oss 指的是什麼:

zypper ar -p 1 http://download.opensuse.org/debug/distribution/leap/15.2/repo/non-oss/ openSUSE-Leap-15.2_non-oss

zypper ar -p 2 http://download.opensuse.org/debug/distribution/leap/15.2/repo/oss/ openSUSE-Leap-15.2_oss

你可以在這裡找到所有的 repos:http: //download.opensuse.org/

我還不得不更改安裝命令,因為包名錯誤:

zypper install php7-gd php7-mcrypt php7-curl php7-intl php7-xsl php7-mbstring php7-openssl php7-zip php7-soap

編輯:但要小心!如您所見,我從openSUSE-Leap-15.0-1 更改openSUSE-Leap-15.2。當我執行zypper update它時,它還將 PHP 從 7.2 更新到 7.3,這導致了 magento 2 中的一些錯誤。如果你不想升級,最好留在你的版本上。

如果一個儲存庫指向不再存在的磁碟/url,只需刪除或禁用該儲存庫:

禁用:

zypper mr -d openSUSE-Leap-15.0-1

消除:

zypper rr openSUSE-Leap-15.0-1

對於其餘部分,我強烈建議您保留自己發行版的儲存庫。使用來自其他(更新的)發行版的軟體包可能會導致依賴性問題,並且您最終可能會升級一半的系統。在那種情況下,為什麼不升級你的整個作業系統呢?

引用自:https://unix.stackexchange.com/questions/558206