タイトル: リポジトリの一覧の確認
SEOタイトル: Linuxパッケージリポジトリ一覧の確認方法(yum / dnf / apt / zypper コマンドまとめ)
| この記事の要点 |
- yum/dnf:
yum repolist all / dnf repolist --all ですべてのリポジトリ(有効/無効)を一覧 - apt (Debian/Ubuntu):
apt-cache policy または cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list - zypper (openSUSE/SLES):
zypper repos (短縮 zypper lr) - 有効リポジトリだけ見たい場合:
yum repolist enabled / dnf repolist --enabled - リポジトリ定義ファイルは
/etc/yum.repos.d/*.repo (RHEL系) / /etc/apt/sources.list.d/ (Debian系) に格納
|
RHEL系 (yum / dnf)
すべてのリポジトリを表示
# yum (RHEL7 / CentOS7)
yum repolist all
# dnf (RHEL8+ / Fedora / Rocky / AlmaLinux)
dnf repolist --all
有効リポジトリだけ表示
yum repolist enabled # yum
dnf repolist --enabled # dnf
dnf repolist # 省略時も enabled 相当
無効リポジトリだけ表示
yum repolist disabled
dnf repolist --disabled
出力例
$ dnf repolist --all
repo id repo name status
appstream Rocky Linux 9 - AppStream enabled
appstream-debug Rocky Linux 9 - AppStream - Debug disabled
baseos Rocky Linux 9 - BaseOS enabled
epel Extra Packages for Enterprise Linux enabled
extras Rocky Linux 9 - Extras enabled
リポジトリ定義ファイル
RHEL系では /etc/yum.repos.d/*.repo に各リポジトリの設定が置かれています。
ls /etc/yum.repos.d/
cat /etc/yum.repos.d/rocky.repo
Debian/Ubuntu (apt)
すべてのリポジトリ情報を表示
# 各パッケージの取得元と優先度
apt-cache policy
# sources.list を直接見る
cat /etc/apt/sources.list
ls /etc/apt/sources.list.d/
cat /etc/apt/sources.list.d/*.list
有効/設定中の sources を整形表示
grep -rhE '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/
PPA (Personal Package Archive) の確認
# 追加された PPA は sources.list.d/ 配下にファイルが置かれる
ls /etc/apt/sources.list.d/ | grep ppa
openSUSE / SLES (zypper)
zypper repos # 一覧
zypper lr # 短縮形
zypper lr -d # URL を含めた詳細
zypper lr -u # URI 表示
コマンド早見表
| ディストリ | パッケージ管理 | 一覧コマンド | 定義ファイル |
| RHEL7 / CentOS7 | yum | yum repolist all | /etc/yum.repos.d/*.repo |
| RHEL8+ / Fedora / Rocky / Alma | dnf | dnf repolist --all | /etc/yum.repos.d/*.repo |
| Debian / Ubuntu | apt | apt-cache policy | /etc/apt/sources.list* |
| openSUSE / SLES | zypper | zypper lr | /etc/zypp/repos.d/*.repo |
| Arch Linux | pacman | cat /etc/pacman.conf | /etc/pacman.conf |
関連操作
- リポジトリの有効化:
dnf config-manager --set-enabled epel
- リポジトリの無効化:
dnf config-manager --set-disabled epel
- キャッシュクリア:
yum clean all / dnf clean all / apt clean
- メタデータ更新:
dnf makecache / apt update