Let’s suppose that you want to test a package not yet landed in the Fedora repos, include it in the installation process or in a Live CD (more on a future post).
A local DNF repository for testing purposes
Let’s go
Install these two packages:
sudo dnf install createrepo koji
The first creates the metadata for your local repository, the latter is useful to download packages from the Fedora build system (https://fedoraproject.org/wiki/Koji).
Go for instance to https://koji.fedoraproject.org and look for the new package to test. Look for the buid ID and download the related RPMs using the koji client.
Create and go to the directory from where you want to serve the RPMs, for instance /var/tmp/localrepo
mkdir /var/tmp/localrepo && cd $_
koji download-build -a x86_64 1065702
Now you should have all the RPMs related to the selected build ID inside such directory.
Let’s create the repository metadata
From inside the aforementioned directory issue the createrepo
command:
cd /var/tmp/localrepo
createrepo .
Serve it via HTTP
Since this is a temporary configuration, just a test, there is no need to sign the repo, and no need to install and configure a webserver like Apache or Nginx.
You can use node.js or Python. Always from inside the aforementioned directory, issue:
python -m SimpleHTTPServer
An http server will start listening on port 8000
Test the repository
You must add a repository config file, like this
sudo vi /etc/yum.repos.d/local-test.repo
[local-test]
name=Fedora 28 - $basearch
baseurl=http://127.0.0.1:8000/
enabled=0
gpgcheck=0
Now you can test if it is all ok.
dnf repository-packages local-test list
You should see a list of the RPMs previously downloaded from koji.