我正在尝试在 Centos 7 上添加 epel.repo。看起来它安装得很好,但它没有显示在列表中并且无法使用它。这是我运行的命令及其输出。我还缺少其他东西吗?
$ sudo yum install epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
epel-release noarch 7-5 extras 14 k
Transaction Summary
====================================================================================================================================
Install 1 Package
Total size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-5.noarch 1/1
Verifying : epel-release-7-5.noarch 1/1
Installed:
epel-release.noarch 0:7-5
Complete!
$ yum repolist
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
ypc-released 113/113
repo id repo name status
base/x86_64 RHEL-7.2 - Base 9,007
extras/x86_64 RHEL-7.2 - Updates Released 191
updates-released/x86_64 RHEL-7.2 - Updates Released 369
ypc-released/x86_64 RHEL-7.2 - Ypc Released 113
repolist: 9,680
$ cd /etc/yum.repos.d/
$ ls -la
total 52
drwxr-xr-x 2 root root 4096 Apr 7 18:05 .
drwxr-xr-x 104 root root 12288 Apr 7 02:01 ..
-rw-r--r-- 1 root root 1664 Dec 9 09:59 CentOS-Base.repo
-rw-r--r-- 1 root root 1309 Dec 9 09:59 CentOS-CR.repo
-rw-r--r-- 1 root root 649 Dec 9 09:59 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 290 Dec 9 09:59 CentOS-fasttrack.repo
-rw-r--r-- 1 root root 630 Dec 9 09:59 CentOS-Media.repo
-rw-r--r-- 1 root root 1331 Dec 9 09:59 CentOS-Sources.repo
-rw-r--r-- 1 root root 1952 Dec 9 09:59 CentOS-Vault.repo
-rw-r--r-- 1 root root 957 Nov 25 2014 epel.repo
-rw-r--r-- 1 root root 1056 Nov 25 2014 epel-testing.repo
$ sudo yum update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No packages marked for update
$ sudo yum list --enablerepo=epel
Loaded plugins: fastestmirror, langpacks
Error getting repository data for epel, repository not found
这是 epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
答案1
在编辑器中打开/etc/yum.repos.d/epel.repo
并查找以 开头的行enabled=
。如果它设置为零,您将不会从yum search
或中的该存储库获得任何包yum install
。要更正此问题,请将该行上的 更改0
为 a 1
。
许多存储库默认设置为不启用,以防止您意外损坏您所依赖的软件包。
答案2
查看 的输出yum repolist
,我看到存储库名称是“RHEL-7.2 - Base”,但在 CentOS7 系统上,它只是 BaseOS。中命名的存储库均不yum repolist
与您在 中显示的文件相对应/etc/yum.repos.d
。
因此,要么您yum repolist
在与生成 yum.repos.d 列表输出的主机不同的主机上运行,要么yum
在您的计算机上在不同的目录中查找存储库。它当然不应该声称拥有 RHEL-7.2 存储库。我从未听说过有人编写使用 /etc/yum.repos.d/ 以外的存储库的 RHEL 克隆,除了 RHEL 的旧 rhn yum 插件,但这会显示在 yum 的输出中。