0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

dnf --releasever=xx は便利

0
Posted at

この記事は RockyLinux10 と EPEL で確認したものです

他のディストリビューションや他のリポジトリで同じ事をできるかは確認していません。

何が起きたか

EPEL のリリースが RockyLinux10 のリリースより先行してしまい、依存関係の問題でEPELから提供されているパッケージが入らなくなってしまいました。

今回は zabbix-agent を入れたかったのですが、下記のように Rocky Linux 10 はすべてのパッケージが最新版の状態で 10.1 なのですが、EPEL が先行してしまって el10_2 つまり 10.2 を想定されています。

$ sudo dnf update
Last metadata expiration check: 2:22:11 ago on Thu 28 May 2026 08:45:19 AM JST.
Dependencies resolved.
Nothing to do.
Complete!


$ sudo dnf install zabbix-agent
Last metadata expiration check: 1:40:59 ago on Thu 28 May 2026 08:45:19 AM JST.
Error: 
 Problem: problem with installed package selinux-policy-targeted-42.1.7-1.el10_1.2.noarch
  - package zabbix7.0-7.0.26-1.el10_2.x86_64 from epel requires (zabbix7.0-selinux if selinux-policy-targeted), 
  - package zabbix7.0-agent-7.0.26-1.el10_2.x86_64 from epel requires zabbix7.0 = 7.0.26-1.el10_2, but none of t
  - conflicting requests
  - nothing provides selinux-policy >= 42.1.13 needed by zabbix7.0-selinux-7.0.26-1.el10_2.noarch from epel
  - nothing provides selinux-policy-base >= 42.1.13 needed by zabbix7.0-selinux-7.0.26-1.el10_2.noarch from epel
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages


$ cat /etc/redhat-release 
Rocky Linux release 10.1 (Red Quartz)

Zabbix公式リポジトリを使うという方法もありますが、あまりリポジトリを増やしたくないので EPEL でなんとかしたい。

じゃあどうすれば

https://dl.fedoraproject.org/pub/epel/ を見ていたら 10.1 用が残っていたので、/etc/yum.repos.d/epel.repo の metalink とかを一瞬だけ変えれば良いのでは?
と考えたのですが、もっと簡単な方法がありました。

結論

sudo dnf install zabbix-agent --releasever=10.1

2026年5月28日 時点

RockyLinux10 + EPEL の場合は --releasever オプションを付けることで、/etc/yum.repos.d/epel.repo の $releasever を上書きできるため、小技を使う必要がなく、また、dnf-automatic を使っている場合、次回のアップデート時には、設定ファイルを一切汚していないため、OS側のリポジトリが追いつけば依存関係の問題が自然に解消され、特別な操作をせずとも通常通りの更新プロセスで最新パッケージになります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?