如何手动添加 yum 存储库?

如何手动添加 yum 存储库?

我正在尝试添加英特尔产品通过创建.repo文件将存储库添加到 dnf 但当我运行时dnf repolist出现此错误:

Failed to synchronize cache for repo 'intel-products', disabling.

我的英特尔产品.repo文件/etc/yum.repos.d看起来像这样:

[intel-products]
name=intel-products
baseurl=https://yum.repos.intel.com/setup/intelproducts.repo
enabled=1
gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

这个文件有什么问题吗?

更新1

正如评论中所建议的,我尝试运行,dnf repolist --verbose结果显示:

Cannot download 'https://yum.repos.intel.com/setup/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.

更改后基本网址变量到 url 的完整路径,我得到相同的结果:

Cannot download 'https://yum.repos.intel.com/setup/intelproducts.repo': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors w
ere tried

更新2:

输出curl https://yum.repos.intel.com/setup/intelproducts.repo

[intel-ipp-repo]
name=Intel(R) Integrated Performance Primitives
baseurl=https://yum.repos.intel.com/ipp
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

[intel-mkl-repo]
name=Intel(R) Math Kernel Library
baseurl=https://yum.repos.intel.com/mkl
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

[intel-tbb-repo]
name=Intel(R) Threading Building Blocks
baseurl=https://yum.repos.intel.com/tbb
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

[intel-mpi-repo]
name=Intel(R) MPI Library
baseurl=https://yum.repos.intel.com/mpi
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

答案1

您的baseurl错误,它应该指向带有repomd.xml 的存储库,而不是.repo 文件。

尝试:

curl https://yum.repos.intel.com/setup/intelproducts.repo > /etc/yum.repos.d/intel-products.repo; dnf repolist

看看效果是否更好

答案2

我需要使用.repo与英特尔创建的完全相同的文件,因为我不知道他们如何定义文件中的变量和值。为此,我使用了curl的输出到标准输出:

curl https://yum.repos.intel.com/setup/intelproducts.repo | cat > intel-products.repo

答案3

curl -O应该可以在 Fedora 上解决这个问题。当然,在 CentOS 7 上也是如此。

# cd /etc/yum.repos.d
# ls i*
ls: cannot access i*: No such file or directory
# curl -O https://yum.repos.intel.com/setup/intelproducts.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1362  100  1362    0     0   3150      0 --:--:-- --:--:-- --:--:--  3145
# ls i*
intelproducts.repo
#

相关内容