The Smallest Example
Let us begin creating a foo repository in the web server containing a single software package, for instance, the package htop:
Create a folder called
fooin/var/www/htmlDownload
htopwith the commandyumdownloader
Note
yumdownloader may not be available in your system. You could figure which package provides it with the command yum provides yumdownloader.
[root@master ~]# mkdir /var/www/html/foo
[root@master ~]# cd /var/www/html/foo
[root@master foo]# yum install epel-release
[root@master foo]# yumdownloader htop
Last metadata expiration check: 1:32:22 ago on Wed 18 Jun 2025 04:14:16 PM EDT.
htop-3.2.1-1.el8.x86_64.rpm 579 kB/s | 170 kB 00:00
Create the repository.
[root@master foo]# yum install -y createrepo_c
[root@master foo]# createrepo .
Up to this point, the local repository is ready to be used.
Be sure to execute the command createrepo every time any package is added or removed from the repository folder.
Let us now use the repository in one of the compute nodes.
In node
c01create a.repofile as shown below.
The .repo file can have any name of your choice, just place it in the directory /etc/yum.repos.d.
Warning
Please check the folder /etc/yum.repos.d on the compute nodes and delete any existent Alma*.repo file.
[root@c01 ~]# cat /etc/yum.repos.d/foo.repo
[foo]
name=foo
baseurl=http://192.168.16.1/foo
enabled=1
gpgcheck=0
priority=1
Verify that the
foorepository exists:
[root@c01 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
core-0 core-0 10,019
foo foo 1
repolist: 10,020
Check the list of packages of the
foorepository,htopshould be listed:
[root@c01 ~]# yum update
...
[root@c01 ~]# yum repo-pkgs foo list
Last metadata expiration check: 0:04:09 ago on Thu 29 May 2025 08:09:53 AM EDT.
Available Packages
htop.x86_64 3.2.1-1.el8 foo
Install the package:
[root@c01 ~]# yum install htop