提供:あわWiki
移動先: 案内検索

Yum リポジトリが有効か無効かを確認する

yumコマンド実行時の有効なリポジトリ、無効なリポジトリの確認方法、設定方法、切り替え方法を説明します。

リポジトリが有効か無効かを確認する

システムに登録されているyumリポジトリは以下のようにして確認することができます。

リポジトリの確認 書式

  • [ all | enabled | disabled ]のオプションを指定しない場合は、enabled が指定されたことになります。

システムに登録されている全てのリポジトリを表示

[root@host3 ~]# yum repolist all
読み込んだプラグイン:fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * rpmforge: mirror.fairway.ne.jp
 * updates: www.ftp.ne.jp
16 packages excluded due to repository priority protections
リポジトリー ID                      リポジトリー名                                                            状態
C7.0.1406-base/x86_64                CentOS-7.0.1406 - Base                                                    無効
C7.0.1406-centosplus/x86_64          CentOS-7.0.1406 - CentOSPlus                                              無効
C7.0.1406-extras/x86_64              CentOS-7.0.1406 - Extras                                                  無効
C7.0.1406-fasttrack/x86_64           CentOS-7.0.1406 - CentOSPlus                                              無効
C7.0.1406-updates/x86_64             CentOS-7.0.1406 - Updates                                                 無効
C7.1.1503-base/x86_64                CentOS-7.1.1503 - Base                                                    無効
C7.1.1503-centosplus/x86_64          CentOS-7.1.1503 - CentOSPlus                                              無効
C7.1.1503-extras/x86_64              CentOS-7.1.1503 - Extras                                                  無効
C7.1.1503-fasttrack/x86_64           CentOS-7.1.1503 - CentOSPlus                                              無効
C7.1.1503-updates/x86_64             CentOS-7.1.1503 - Updates                                                 無効
base/7/x86_64                        CentOS-7 - Base                                                           有効:  9,007  ← 有効なリポジトリ
base-debuginfo/x86_64                CentOS-7 - Debuginfo                                                      無効
base-source/7                        CentOS-7 - Base Sources                                                   無効

有効なリポジトリだけを表示

[root@host3 ~]# yum repolist enabled                                                                                       
読み込んだプラグイン:fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * rpmforge: mirror.fairway.ne.jp
 * updates: www.ftp.ne.jp
16 packages excluded due to repository priority protections
リポジトリー ID                                      リポジトリー名                                                  状態
base/7/x86_64                                        CentOS-7 - Base                                                  9,007
extras/7/x86_64                                      CentOS-7 - Extras                                                  191
rpmforge                                             RHEL 7 - RPMforge.net - dag                                     229+16
updates/7/x86_64                                     CentOS-7 - Updates                                                 369
repolist: 9,796

無効になっているリポジトリだけを表示

[root@host3 ~]# yum repolist disabled                                                                                      
読み込んだプラグイン:fastestmirror, priorities
リポジトリー ID                             リポジトリー名                                                                 
C7.0.1406-base/x86_64                       CentOS-7.0.1406 - Base                                                         
C7.0.1406-centosplus/x86_64                 CentOS-7.0.1406 - CentOSPlus                                                   
C7.0.1406-extras/x86_64                     CentOS-7.0.1406 - Extras                                                       
C7.0.1406-fasttrack/x86_64                  CentOS-7.0.1406 - CentOSPlus                                                   
C7.0.1406-updates/x86_64                    CentOS-7.0.1406 - Updates                                                      
C7.1.1503-base/x86_64                       CentOS-7.1.1503 - Base                                                         
C7.1.1503-centosplus/x86_64                 CentOS-7.1.1503 - CentOSPlus                                                   
C7.1.1503-extras/x86_64                     CentOS-7.1.1503 - Extras                                                       
C7.1.1503-fasttrack/x86_64                  CentOS-7.1.1503 - CentOSPlus                                                   
C7.1.1503-updates/x86_64                    CentOS-7.1.1503 - Updates                                                      
base-debuginfo/x86_64                       CentOS-7 - Debuginfo                                                           
base-source/7                               CentOS-7 - Base Sources                                                        
c7-media                                    CentOS-7 - Media                                                               
centosplus/7/x86_64                         CentOS-7 - Plus                                                                
centosplus-source/7                         CentOS-7 - Plus Sources                                                        
!cr/7/x86_64                                CentOS-7 - cr                                                                  
!epel/x86_64                                Extra Packages for Enterprise Linux 7 - x86_64                                 
epel-debuginfo/x86_64                       Extra Packages for Enterprise Linux 7 - x86_64 - Debug                         
epel-source/x86_64                          Extra Packages for Enterprise Linux 7 - x86_64 - Source                        
epel-testing/x86_64                         Extra Packages for Enterprise Linux 7 - Testing - x86_64                       
epel-testing-debuginfo/x86_64               Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug               
epel-testing-source/x86_64                  Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source              
extras-source/7                             CentOS-7 - Extras Sources                                                      
fasttrack/7/x86_64                          CentOS-7 - fasttrack                                                           
rpmforge-extras                             RHEL 7 - RPMforge.net - extras                                                 
rpmforge-testing                            RHEL 7 - RPMforge.net - testing                                                
updates-source/7                            CentOS-7 - Updates Sources                                                     
repolist: 0

特定のリポジトリについて調べたい場合

  • リポジトリIDを指定すると、その特定のリポジトリについてだけを調べることができます。
  • 「-v」をつけて実行するとより詳細なリポジトリの状態を表示します。
[root@host3 ~]# yum repolist base -v
プラグイン「fastestmirror」を読み込んでいます
プラグイン「priorities」を読み込んでいます
Config time: 0.009
Yum version: 3.4.3
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * rpmforge: mirror.fairway.ne.jp
 * updates: www.ftp.ne.jp
Setting up Package Sacks
 --> python-crypto-2.6.1-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> socat-1.7.2.4-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> hwloc-1.4.1-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> sdparm-1.08-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> nettle-devel-2.2-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> convmv-1.15-1.el7.rf.noarch from rpmforge excluded (priority)
 --> python-crypto-2.0.1-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> hwloc-devel-1.4.1-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> latencytop-0.5-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> nettle-2.2-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> syslinux-3.86-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> source-highlight-3.1.6-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> source-highlight-devel-3.1.6-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> lshw-gui-2.17-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> hexedit-1.2.10-1.el7.rf.x86_64 from rpmforge excluded (priority)
 --> lshw-2.17-1.el7.rf.x86_64 from rpmforge excluded (priority)
16 packages excluded due to repository priority protections
pkgsack time: 0.507
リポジトリー ID            : base/7/x86_64
リポジトリーの名前         : CentOS-7 - Base
リポジトリーの状態         : 有効
リポジトリーのリビジョン   : 1449700451
リポジトリー更新日         : Thu Dec 10 07:35:45 2015
リポジトリー内パッケージ数 : 9,007
リポジトリー容量           : 6.5 G
リポジトリーのミラー       : http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os
リポジトリー基準 URL       : http://www.ftp.ne.jp/Linux/packages/CentOS/7.2.1511/os/x86_64/ (9 more)
リポジトリーの期限         : 21,600 秒 (最終: Wed Dec 23 13:11:11 2015)
Repo ファイル名: /etc/yum.repos.d/CentOS-Base.repo

repolist: 9,007

リポジトリの設定で有効/無効を切り替える

/etc/yum.repos.d/*.repo ファイルでリポジトリごとの動作を設定できます。yumコマンド実行時のリポジトリの有効/無効についても、この構成ファイルの中で設定できます。

[root@host3 ~]# vi /etc/yum.repos.d/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=0 ← enabled オプション
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
  • 指定する値についての説明は以下のとおり
意味
0 リポジトリを無効にする。enable=0 のように書く
1 リポジトリを有効にする。enable=1 のように書く
  • ここで設定していても、yum コマンド実行時に、--enablerepo=リポジトリID、--disablerepo=リポジトリIDでリポジトリの有効無効を切り替えることは可能です。