What you need to create a local repository in centos 7 over http is a web server (httpd) and createrepo command. Let's assume the ip address of this server is 10.10.10.10.
# yum install httpd createrepo yum-utils -y
Then, create a directory to store the repository files
# mkdir /var/www/html/repos
Create XML based rpm meta-structure repository, like an index file that points to rpm files for our repository
# createrepo /var/www/html
Configure httpd to allow followsymlinks
# diff -u /etc/httpd/conf/httpd.conf.ori /etc/httpd/conf/httpd.conf
--- httpd.conf.ori 2021-12-06 12:23:36.704096479 +0800
+++ httpd.conf 2021-12-06 12:21:37.423092872 +0800
@@ -141,7 +141,8 @@
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
- Options Indexes FollowSymLinks
+ #Options Indexes FollowSymLinks
+ Options All Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# httpd -t
# systemctl restart httpd
# yum install yum-utils
# reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/
# firewall-cmd --add-service http
# firewall-cmd --add-service http --permanent
# cat >> /etc/yum.repos.d/local.repo <<EOF[local]name=CentOS Apachebaseurl=http://10.10.10.10enabled=1gpgcheck=0EOF
# yum repolist