yumのリポジトリの追加登録方法 (CentOS 7)

CentOS 7の場合のリポジトリの追加登録方法について記載します。

1. EPEL(Extra Packages for Enterprise Linux)

(1) yumでインストール
# yum install epel-release
もしくは
# yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm
※バージョンアップにより、ファイル名が変更している場合があるので、注意して下さい。

(2) 設定ファイルの編集
インストールが完了すると、「/etc/yum.repos.d」ディレクトリに「epel.repo」が作成されます。
このファイルを編集します。

# vi /etc/yum.repos.d/epel.repo

[epel]セクションで「enabled=0」とします。
[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
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

(3) 利用方法
# yum --enablerepo=epel -y install (パッケージ名)


2. Remi

(1) インストール
# yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

(2) 利用方法
# yum --enablerepo=remi -y install (パッケージ名)

3. MySQL

(1) インストール
# yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

(2) 設定ファイルの編集
インストールが完了すると、「/etc/yum.repos.d」ディレクトリに「mysql-community.repo」が作成されます。
このファイルを編集します。

# vi /etc/yum.repos.d/mysql-community.repo

各セクションで「enabled=1」を「enabled=0」とします。
# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
#enabled=1
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
#enabled=1
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
#enabled=1
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql-cluster-7.5-community]
name=MySQL Cluster 7.5 Community
baseurl=http://repo.mysql.com/yum/mysql-cluster-7.5-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql-cluster-7.6-community]
name=MySQL Cluster 7.6 Community
baseurl=http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql-cluster-8.0-community]
name=MySQL Cluster 8.0 Community
baseurl=http://repo.mysql.com/yum/mysql-cluster-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

4. IUS(Inline with Upstream Stable)

(1) yumでインストール
# yum install  https://repo.ius.io/ius-release-el7.rpm

(2) 設定ファイルの編集
インストールが完了すると、「/etc/yum.repos.d」ディレクトリに「ius.repo」が作成されます。
このファイルを編集します。

# vi /etc/yum.repos.d/ius.repo

[ius]セクションで「enabled=0」とします。
[ius]
name = IUS for Enterprise Linux 7 - $basearch
baseurl = https://repo.ius.io/7/$basearch/
#enabled = 1
enabled = 0
repo_gpgcheck = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7
 
[ius-debuginfo]
name = IUS for Enterprise Linux 7 - $basearch - Debug
baseurl = https://repo.ius.io/7/$basearch/debug/
enabled = 0
repo_gpgcheck = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7
 
[ius-source]
name = IUS for Enterprise Linux 7 - Source
baseurl = https://repo.ius.io/7/src/
enabled = 0
repo_gpgcheck = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7

(3) 利用方法
# yum --disablerepo=base,extras,updates --enablerepo=ius -y install (パッケージ名)
※「--disablerepo=base,extras,updates」を付けないとそのまま「base」のパッケージを利用しようとするので、注意して下さい。

(4) GPG鍵の取得に失敗した場合
GPG 鍵の取得に失敗しました: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY"
上記のようなエラーが表示され、インストールが失敗した場合には、GitHubサイトからGPG鍵を取得して、作成します。

GPG鍵を画面に表示させ、コピーします。
IUS-COMMUNITY-GPG-KEY

「/etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY」にテキストを作成して、ペーストします。
# vi /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY








最終更新:2021年03月31日 08:33