This post includes some quick instructions to setup an Apache2-homed yum/dnf repo on and for RHEL8.
Install Apache2 and createrepo:
sudo yum -y install httpd createrepo
Start Apache2:
sudo systemctl start httpd
sudo systemctl enable httpd
Prepare directory with custom RPM(s):
mkdir /var/www/html/customrepo
cd /var/www/html/customrepo
sudo cp /home/user/CustomApp-1.0.0-1.rpm /var/www/html/customrepo/
Create the repo indexing files:
sudo createrepo /var/www/html/customrepo/
Now the repo should be “live”, but we need a repo file to reference it from clients. We will create and test a “local” repo file. Create/edit a “custom.repo” file (we’ll use nano for this):
sudo nano /etc/yum.repos.d/custom.repo
In the custom repo file, a minimal configuration might look like this:
[custom]
name=custom
metadata_expire=-1
enabled=1
gpgcheck=0
baseurl=http://localhost/customrepo/
You should now be able to test the custom repo by installing a package like this:
sudo yum -y install customapp