我尝试安装一些 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_10000000000000000001)而不是来自互联网。但是光盘不再插入,我也不能插入,因为它是我公司的虚拟机,而且管理员正在休假。
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/
如何更改存储库以便从互联网加载?
我知道我可以使用 修改现有存储库zypper modifyrepo
,但如何修改 URI 以及在哪里可以找到正确的 URI?
答案1
如果一个存储库指向不再存在的磁盘/url,只需删除或禁用该存储库:
禁用:
zypper mr -d openSUSE-Leap-15.0-1
消除:
zypper rr openSUSE-Leap-15.0-1
对于其余的,我强烈建议您保留自己发行版的存储库。使用其他(更新的)发行版中的软件包可能会导致依赖性问题,并且您可能最终会升级一半的系统。在这种情况下,为什么不升级整个操作系统呢?
答案2
似乎无法重命名 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
您可以在这里找到所有存储库: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 中的一些错误。如果您不想升级,最好保留您的版本。