After setting up a server or provisioning a VM that meets the above requirements, follow these steps to set up the repository.
Login to your internal repository as the root user through SSH or the console.
The rsync, cronie, and httpd packages must be functional to create a repository. Install these packages by running the command:
shell> dnf install rsync httpd cronieThis will install any of those packages if they are missing.
Make a set of directories that will host the repository packages:
shell> mkdir -p /var/www/html/rocky/9/{os,appstream,extras}/x86_64
Use rsync
to create a clone of the Base OS packages from the preferred online mirror. In the following command, replace <mirror-url>
with the rsync
URL for the chosen online repository:
shell> /usr/bin/rsync -avrt <mirror-url>/9.3/BaseOS/x86_64/os/ --exclude=debug /var/www/html/rocky/9/os/x86_64
Example command using the Rochester Institute of Technology mirror:
shell>/usr/bin/rsync -avrt rsync://mirrors.rit.edu/rocky/9.3/BaseOS/x86_64/os/ --exclude=debug /var/www/html/rocky/9/os/x86_64
This will download approximately 9 GB of packages to the internal repository.Use rsync
to create a clone of the AppStream packages from the preferred online mirror. In the following command, replace <mirror-url>
with the rsync
url for the chosen online repository:
shell> /usr/bin/rsync -avrt <mirror-url>/9.3/AppStream/x86_64/os/ --exclude=debug /var/www/html/rocky/9/appstream/x86_64
Example command using the Rochester Institute of Technology mirror:
shell>/usr/bin/rsync -avrt rsync://mirrors.rit.edu/rocky/9.3/AppStream/x86_64/os/ --exclude=debug /var/www/html/rocky/9/appstream/x86_64
Use rsync
to create a clone of the Extras packages from the preferred online mirror. In the following command, replace <mirror-url>
with the rsync
url for the chosen online repository:
shell> /usr/bin/rsync -avrt <mirror-url>/9.3/extras/x86_64/os/ --exclude=debug /var/www/html/rocky/9/extras/x86_64
Example command using the Rochester Institute of Technology mirror:
shell>/usr/bin/rsync -avrt rsync://mirrors.rit.edu/rocky/9.3/extras/x86_64/os/ --exclude=debug /var/www/html/rocky/9/extras/x86_64
With all the packages in place, the internal repository is almost ready to distribute packages. Start the Apache httpd server to bring the repository online:
shell> service httpd start
Use the following command to ensure httpd
is started automatically whenever the repository is restarted:
shell>chkconfig httpd on
The local Rocky firewall is most likely blocking access to the internal repository by default. Add a new rule to allow traffic to port 80.
shell>firewall-cmd --permanent --zone=public --add-port=80/tcp
After the new rule has been added, restart the firewall with the command:
shell>systemctl restart firewalld
The internal repository has all the current packages now, but it will quickly become out of date as new updates are pushed out to the online repositories. To keep the internal repository up to date, setup a cron
job to periodically download updates from the preferred repository. To create a cron
job, run the command:
shell> crontab -eThis will open an editor to add the
cron
script. Write out the following on a single line in the editor (replacing <mirror-url>
with the rsync
url for your chosen online repository):
00 00 * * * /usr/bin/rsync -avrt <mirror-url>
/9.3/BaseOS/x86_64/os/ --delete --exclude=debug /var/www/html/rocky/9/os/x86_64
00 00 * * * /usr/bin/rsync -avrt <mirror-url>
/9.3/AppStream/x86_64/os/ --delete --exclude=debug /var/www/html/rocky/9/appstream/x86_64
00 00 * * * /usr/bin/rsync -avrt <mirror-url>
/9.3/extras/x86_64/os/ --delete --exclude=debug /var/www/html/rocky/9/extras/x86_64
This will download updates from the online repository every midnight.
The internal repository is setup, ready for use, and configured to update itself automatically. The next section will cover configuring your SAKA to use the internal repository for package management.