Create a local dnf repo from a directory of packages
Published: 14 August 2025
Install the createrepo_c tool if it is not already installed.
sudo dnf install createrepo_c
Create a directory for the repo and copy the packages
sudo mkdir /srv/repos/local
Create the repository metadata
sudo createrepo_c /srv/repos/local
Create a repo configuration in /etc/yum/repos.d/. It's named must end in
.repo
.
cat /etc/yum/repos.d/local.repo
[local-repo]
name=Local Repository
baseurl=file:///srv/repos/local
enabled=1
gpgcheck=0
If the packages you are trying to install conflict with packages from a
module, such as when installing hotfixes you need to do module_hotfixes=1
to
the yum config.
cat /etc/yum/repos.d/local.repo
[local-repo]
name=Local Repository
baseurl=file:///srv/repos/local
enabled=1
gpgcheck=0
module_hotfixes=1
Install (or update) from your new repo as you normally would.
dnf update <package>
dnf install <package>