安装包的问题

安装包的问题

当我运行此命令时,我收到这些消息:

# yum install pcre pcre-devel php php-common php-gd php-cli php-mysql flex bison
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
No package pcre-devel available.
No package php available.
No package php-common available.
No package php-gd available.
No package php-cli available.
No package php-mysql available.
No package flex available.
No package bison available.
Nothing to do

我该如何解决这个问题?

答案1

列出启用的存储库

在 CentOS 6.x 机器上,我有以下存储库:

$ yum repolist|column
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: mirrors.usinternet.com
 * epel: mirror.steadfast.net
 * extras: centos.mbni.med.umich.edu
 * updates: centos.mirrors.tds.net
76 packages excluded due to repository priority protections
repo id         repo name                                               status
base            CentOS-6 - Base                                         6,315+66
epel            Extra Packages for Enterprise Linux 6 - x86_64             9,349
extras          CentOS-6 - Extras                                            6+7
updates         CentOS-6 - Updates                                       1,020+3
repolist: 16,690

包 X 来自哪个存储库?

在 CentOS 6.x 上,当我使用命令时,repoquery我发现以下软件包来自这些存储库:

$ for i in pcre pcre-devel php php-common php-gd php-cli php-mysql flex bison ; do 
  echo -n $i; repoquery -i --archlist=`uname -m` $i \
            | grep Repo | sed 's/Repository//'; 
done | column -t

产生以下输出:

pcre        :  base
pcre-devel  :  base
php         :  updates
php-common  :  updates
php-gd      :  updates
php-cli     :  updates
php-mysql   :  updates
flex        :  base
bison       :  base

列出所有可用的存储库

您可以使用以下命令查看您的盒子有哪些可用的存储库:

$ yum repolist all
...
...
C6.3-contrib                   CentOS-6.3 - Contrib                                                      disabled
C6.3-extras                    CentOS-6.3 - Extras                                                       disabled
C6.3-updates                   CentOS-6.3 - Updates                                                      disabled
base                           CentOS-6 - Base                                                           enabled: 6,315+66
c6-media                       CentOS-6 - Media                                                          disabled
centosplus                     CentOS-6 - Plus                                                           disabled
contrib                        CentOS-6 - Contrib                                                        disabled
debug                          CentOS-6 - Debuginfo                                                      disabled
epel                           Extra Packages for Enterprise Linux 6 - x86_64                            enabled:    9,349
epel-debuginfo                 Extra Packages for Enterprise Linux 6 - x86_64 - Debug                    disabled
epel-source                    Extra Packages for Enterprise Linux 6 - x86_64 - Source                   disabled
epel-testing                   Extra Packages for Enterprise Linux 6 - Testing - x86_64                  disabled
epel-testing-debuginfo         Extra Packages for Enterprise Linux 6 - Testing - x86_64 - Debug          disabled
epel-testing-source            Extra Packages for Enterprise Linux 6 - Testing - x86_64 - Source         disabled
extras                         CentOS-6 - Extras                                                         enabled:      6+7
updates                        CentOS-6 - Updates                                                        enabled:  1,020+3
repolist: 16,690

启用存储库

要启用已禁用的存储库之一:

$ yum-config-manager --enablerepo=<reponame>

例如:

$ yum-config-manager --enablerepo=centosplus

添加存储库

如果您有存储库 .repo 文件,您可以添加它并启用它,如下所示:

$ yum-config-manager --add-repo http://www.example.com/example.repo
$ yum-config-manager --enablerepo=example

相关内容