Listing enabled repos
On a CentOS 6.x box I have the following repositories:
$ 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
Which repository does package X come from?
On CentOS 6.x when I use the command repoquery
I find the following packages are from these repositories:
$ 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
Produces the following output:
pcre : base
pcre-devel : base
php : updates
php-common : updates
php-gd : updates
php-cli : updates
php-mysql : updates
flex : base
bison : base
List all available repos
You can see what repos are available for your box with this command:
$ 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
Enabling a repo
To enable one of the disabled repos:
$ yum-config-manager --enablerepo=<reponame>
For example:
$ yum-config-manager --enablerepo=centosplus
Adding a repo
If you have a repositories .repo file you can add it and enable it like so:
$ yum-config-manager --add-repo http://www.example.com/example.repo
$ yum-config-manager --enablerepo=example
# yum repolist
– Shâu Shắc Jul 28 at 10:57