When running Rocky Linux 9, you may want to install a package that is only available in Oracle Linux 9’s repositories — such as bcache-tools. However, enabling a whole external repository can cause compatibility issues if many packages are pulled in unintentionally. To avoid this, you can configure includepkgs so that only the desired package is allowed from the Oracle repository.
This article shows a minimal setup to safely install bcache-tools on Rocky Linux 9 using Oracle’s repositories.
Step 1: Import Oracle’s GPG Key
First, download and import the Oracle GPG key:
sudo rpm --import https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9
Step 2: Create a Repository File
Next, create a repo file that points to Oracle Linux 9’s BaseOS repository. Use includepkgs to allow only bcache-tools:
sudo tee /etc/yum.repos.d/ol9-oracle.repo > /dev/null <<'EOF'
[ol9-baseos]
name=Oracle Linux 9 BaseOS Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/$basearch/
gpgcheck=1
enabled=1
includepkgs=bcache-tools
EOF
Key points:
-
includepkgs=bcache-toolsensures only that package can be installed from this repo. - You can list multiple packages separated by commas, e.g.
includepkgs=pkg1,pkg2. - Using
enabled=1is fine since the filter prevents other packages from being pulled in. If you prefer, setenabled=0and enable it only when needed with--enablerepo.
Step 4: Install bcache-tools
Finally, install the package:
sudo dnf install bcache-tools
Thanks to includepkgs, only bcache-tools (and any explicitly listed dependencies) will be pulled from Oracle’s repo.
Notes and Caveats
-
includepkgsis a per-repo filter and does not affect other repositories. - If
bcache-toolsdepends on packages that Rocky does not provide, you must add those to theincludepkgslist as well. - Use
dnf --downloadonlyorrepoqueryto inspect what will be installed before proceeding. - Remember that
bcachealso requires kernel support. Installingbcache-toolsalone is not sufficient if your kernel does not havebcacheenabled.
✅ With this method, you can safely use Oracle Linux’s repository on Rocky Linux to install just bcache-tools — without risking unintentional system-wide package replacements.
Top comments (0)