自宅サーバー ≫ Linux Server ≫ CentOS 7 ≫ yum 用リポジトリの追加

 
yum 用リポジトリプラグインのインストール
標準リポジトリと追加リポジトリの両方から提供されている重複パッケージは、標準リポジトリ提供のものを優先するようにする
 
 
[root@centos]# yum -y install yum-plugin-priorities
 
公式リポジトリ設定ファイルの編集
 
 
[root@centos]# vi /etc/yum.repos.d/CentOS-Base.repo
 # CentOS-Base.repo
 #
 # The mirror system uses the connecting IP address of the client and the
 # update status of each mirror to pick mirrors that are updated to and
 # geographically close to the client. You should use this for CentOS updates
 # unless you are manually picking other mirrors.
 #
 # If the mirrorlist= does not work for you, as a fall back you can try the
 # remarked out baseurl= line instead.
 #
 #

 [base]
 
priority=1    <--- 追記
 name=CentOS-$releasever - Base
 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
 #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 #released updates
 [updates]
 
priority=1    <--- 追記
 name=CentOS-$releasever - Updates
 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
 #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 #additional packages that may be useful
 [extras]
 
priority=1    <--- 追記
 name=CentOS-$releasever - Extras
 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
 #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 #additional packages that extend functionality of existing packages
 [centosplus]
 
priority=1    <--- 追記
 name=CentOS-$releasever - Plusmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
 $basearch&repo=centosplus&infra=$infra#baseurl=http://mirror.centos.org/centos/
 gpgcheck=1                                                        $releasever/centosplus/$basearch/
 enabled=0
   <--- 書き替え(通常使う設定にする<有効>)
      ↓             (1:有効 2:無効)
 
enabled=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
epel-release のインストール
CentOS7の公式リポジトリにはepel-releaseパッケージが含まれているで yum でインストールする
 
 [root@centos]#
yum -y install epel-release.noarch
 
追加(epel-release)リポジトリ設定ファイルの編集
 
 
[root@centos]# vi /etc/yum.repos.d/epel.repo
 [epel]
 priority=2    <--- 追記(公式設定ファイルが1なのでそれより後ろの番号
 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
   <--- 書き替え(通常は公式設定ファイルを使うので使わない設定にする<無効>)
      ↓                             (1:有効 2:無効)
 
enabled=0
 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
   <--- 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
   <--- 0になっているか確認
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
 gpgcheck=1
 
ここで設定していても、yum コマンド実行時に、--enablerepo=リポジトリID、--disablerepo=リポジトリIDでリポジトリの有効無効を切り替えることができる
Remi のインストール
 
 [root@centos]#
http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
 
追加(remi)リポジトリ設定ファイルの編集
 
 
[root@centos]# vi /etc/yum.repos.d/remi.repo
 [remi]
 
priority=3    <--- 追記(公式ファイルが1 epelファイルが2なのでそれより後ろの番号 )
 name=Remi's RPM repository for Enterprise Linux 7 - $basearch
 #baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/
 #mirrorlist=https://rpms.remirepo.net/enterprise/7/remi/httpsmirror
 mirrorlist=http://cdn.remirepo.net/enterprise/7/remi/mirror
 enabled=0
   <--- 0になっているか確認
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 [remi-php55]
 name=Remi's PHP 5.5 RPM repository for Enterprise Linux 7 - $basearch
 #baseurl=http://rpms.remirepo.net/enterprise/7/php55/$basearch/
 #mirrorlist=https://rpms.remirepo.net/enterprise/7/php55/httpsmirror
 mirrorlist=http://cdn.remirepo.net/enterprise/7/php55/mirror
 # NOTICE: common dependencies are in "remi-safe"
 enabled=0
   <--- 0になっているか確認
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 [remi-php56]
 name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch
 #baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/
 #mirrorlist=https://rpms.remirepo.net/enterprise/7/php56/httpsmirror
 mirrorlist=http://cdn.remirepo.net/enterprise/7/php56/mirror
 # NOTICE: common dependencies are in "remi-safe"
 enabled=0
   <--- 0になっているか確認
 gpgcheck=1
 
ここで設定していても、yum コマンド実行時に、--enablerepo=リポジトリID、--disablerepo=リポジトリIDでリポジトリの有効無効を切り替えることができる
※なお、Remi を利用する場合は上記 epel が設定されていることが必須条件
Nux Dextop のインストール
 
 
[root@centos]# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
 
[root@centos]#  rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
 
追加(Nux Dextop)リポジトリ設定ファイルの編集
 
 
[root@centos]# vi /etc/yum.repos.d/nux-dextop.repo
 [nux-dextop]
 priority=4    <--- 追記(公式ファイルが1 epelファイルが2 remiファイルが3なのでそれより後ろの番号 )
 name=Nux.Ro RPMs for general desktop use
 
baseurl=http://li.nux.ro/download/nux/dextop/el7/$basearch/  http://mirror.li.nux.ro/li.nux.ro/nux/dextop/el7/$basearch/
 enabled=1
   <--- 書き替え(通常は公式設定ファイルを使うので使わない設定にする<無効>
      ↓                             (1:有効 2:無効)
 
enabled=0
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
 protect=0

 [nux-dextop-testing]
 name=Nux.Ro RPMs for general desktop use - testing
 baseurl=http://li.nux.ro/download/nux/dextop-testing/el6/$basearch/
 enabled=0
   <--- 0になっているか確認
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
 protect=0
 
ここで設定していても、yum コマンド実行時に、--enablerepo=リポジトリID、--disablerepo=リポジトリIDでリポジトリの有効無効を切り替えることができる
有効なリポジトリの一覧表示
 
 
[root@centos]# yum repolist
 読み込んだプラグイン:fastestmirror, langpacks, priorities
 Loading mirror speeds from cached hostfile
  * base: ftp.jaist.ac.jp
  * centosplus: ftp.jaist.ac.jp
  * extras: ftp.jaist.ac.jp
  * updates: ftp.jaist.ac.jp
 base                                                             | 3.6 kB 00:00:00
 centosplus                                                       | 3.4 kB 00:00:00
 extras                                                           | 3.4 kB 00:00:00
 updates                                                          | 3.4 kB 00:00:00
 centosplus/7/x86_64/primary_db                                   | 824 kB 00:00:11

 リポジトリー ID                      リポジトリー名                         状態
 base/7/x86_64                        CentOS-7 - Base                        9,911
 centosplus/7/x86_64                  CentOS-7 - Plus                           23
 extras/7/x86_64                      CentOS-7 - Extras                        258
 updates/7/x86_64                     CentOS-7 - Updates                       151
 repolist: 10,343
[root@papa-net-server ~]#
 
上記のように公式リポジトリだけが有効になっている
無効なリポジトリの一覧表示
 
 
[root@centos]# yum repolist disabled
 読み込んだプラグイン:fastestmirror, langpacks, 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
 
 
途中略
 
 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
 
 
途中略
 
 nux-dextop/x86_64                Nux.Ro RPMs for general desktop use
 nux-dextop-testing/x86_64        Nux.Ro RPMs for general desktop use - testing
 
 
途中略
 
 remi                             Remi's RPM repository for Enterprise Linux 7 - x86_64
 remi-debuginfo/x86_64            Remi's RPM repository for Enterprise Linux 7 - x86_64 - debuginfo
 remi-php54                       Remi's PHP 5.4 RPM repository for Enterprise Linux 7 - x86_64
 remi-php55                       Remi's PHP 5.5 RPM repository for Enterprise Linux 7 - x86_64
 remi-php56                       Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - x86_64
 remi-php70                       Remi's PHP 7.0 RPM repository for Enterprise Linux 7 - x86_64
 remi-php70-test                  Remi's PHP 7.0 test RPM repository for Enterprise Linux 7 - x86_64
 
yumに関するキャッシュやデータベースの消去
 
 [root@centos]#
rm -fr /var/cache/yum/*
 [root@centos]#
yum clean all
 

戻る