Issues while setting reposerver for the rocky host

Requirement: We have customized rocky 8.7 vm and it will be in air gapped environment, where it will not connect to outside internet So we want to configure a reposerver on the different vm on the same network with the rocky vm only.

Steps Taken:

  1. on the reposerver added the entry in the hosts file so that it will resolve with hostname as well “rocky.reposerver.com
  2. Installed nginx and yum utisl
  3. mounted customized rocky iso to reposerver vm and copied the BaseOS and AppStream folders to /usr/share/nginx/html/repos/
  4. In the /etc/nginx/conf.d/repo.conf file added below entry

vi /etc/nginx/conf.d/repos.conf

server {
listen 80;
server_name “address of reposerver”;
root /usr/share/nginx/html/repos;
index index.html;
location / {
autoindex on;
}
}

  1. restarted nginx
  2. now on http://rocky.reposerver.com both the BaseOS and AppStream are visible
  3. now went to the client rocky vm and moved all repo files from yum.repos.d folder
  4. created localrepo.repo inside it
    [localrepo-base]
    name=RockyLinux Base
    baseurl=http link with reposerver address with BaseOS at the last
    gpgcheck=0
    enabled=1

[localrepo-appstream]
name=RockyLinux AppStream
baseurl=http link with reposerver address with AppStream at the last
gpgcheck=0
enabled=1

  1. now done dnf clean all and ran dnf repolist both the repos are visible
    10 But while installting any package it is giving error pakcage not found.

Request you to let me know if any other things need to be done so that i can install packages, i have just copied the BaseOS and AppStream folders from my customized iso that is already a working iso

Above method is totally correct, i was downloading the package that was not available in the packages, so added that package and ran createrepo_c and now able to download the package