HowTo Setup a Local YUM/DNF RPM Repository
Note: This document is mere scratch notes at the moment. I.e. a work in progress.
- Create a directory for the repository: Example, ~/repo
cd ~ mkdir repo
Note: If you are sharing this with many users, you make want to do this as root and in the
- Install the tool needed to create repos...
sudo dnf install createrepo_c
- Copy the RPMs you want to include in the repo, into the repo...
cp /path/to/rpms/*.rpm repo/
- Create the repo metadata...
cd repo createrepo_c .
And, of course, if you did this in
/var/repo you will want to do this as root:
sudo createrepo_c .
- Create the yum .repo configuration file so that your linux system will now be able to fetch things from that repository...
Using a text editor as root create and edit
add this text to it and then save...
[my-rpms] # No spaces allowed in that [repo-name] or you get a "bad id for repo" error name=My RPMs $releasever - $basearch baseurl=/home/<USERNAME>/repo enabled=1 metadata_expire=1d gpgcheck=0 #gpgcheck=1 #gpgkey=file:///<path to GPG key>/key.asc #gpgkey=https://<URL to GPG key>/key.asc
- Replace "" with your username -- if using the
/vardirectory, that doesn't apply, of course.
- If you didn't sign your packages, make sure the "gpgcheck" flag is off. Signing packages is beyond the scope of this document.
- Check that it yum/dnf knows about your repository...
sudo dnf repolist
Your repository should show on in the list.
- Install your RPM...
Note: For the first run, you will likely have to use the
--refresh flag and
any time you add more RPMs and refresh that repository.
sudo dnf install the-rpm-i-want-to-install
- Adding RPMs to that repository...
Just go through the same process starting at step 3. To install anything
though you will definitely have to add
--refresh to the
commandline unless you wait the time needed for the metadata to expire.
cd ~/repo cp /path/to/new-rpms/*.rpm ./ createrepo_c . sudo dnf install the-rpm-i-want-to-install --refresh
Really, that is all there is to it. You can also make RPMs from a
repo available via HTTP. To do that, this reference may help you out: