Running local mirrors of the official repositories is only supported on a best-effort level.
Purpose
This how-to is aimed towards the users who wants to create a local mirror of the OP5 repositories instead of fetching them via the Internet directly.
It may be need to be modified to work with different versions of OP5 Monitor and CentOS.
Prerequisites
- A server running OP5 Monitor or the OP5 Appliance System with a valid license
- A server running the 64 bit version of CentOS 7.x for hosting of the local mirror with 4 GB of free disk space
Configuration of the local mirror
1. Make sure that the server hosting the local mirror is up to date:
# yum update -y
2. Install the packages "yum-utils" and "createrepo"
# yum install -y yum-utils createrepo
3. Copy the repository configuration files and verification keys from the OP5 Monitor system to the mirror host:
# scp root@<monitorhost>:/etc/yum.repos.d/op5-* /etc/yum.repos.d/
# scp root@<monitorhost>:/etc/pki/rpm-gpg/RPM-GPG-KEY-op5 /etc/pki/rpm-gpg/
This step may need to be executed again if new repositories are added by OP5.
4. Verify that the repositories has been installed correctly:
$ yum repolist
5. Install and enable Apache httpd to serve our repository mirror:
# yum install -y httpd
# systemctl start httpd
# systemctl enable httpd
If you have the iptables firewall enabled, make sure to allow inbound traffic for port 80/TCP
6. Create a repository directory and synchronize the packages to the local system:
# mkdir /var/www/html/repos
$ cd /var/www/html/repos
# reposync -l -r "op5-*"
Synchronizing the repositories can take some time, depending on your Internet connection
7. Create metadata for the locally synchronized repositories:
# for REPO in $(find /var/www/html/repos -iname "op5-*" -type d); do createrepo ${REPO}; done
Configuring the OP5 Monitor system
8. Reconfigure the repositories on the op5 Monitor server to use the local mirror by changing the "baseurl" setting:
/etc/yum.repos.d/op5-release.repo
[op5-monitor-base]
name=op5 Monitor Base
baseurl=http://<local-op5-repo-address>/repos/op5-monitor-base
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-op5%
[op5-monitor-updates]
name=op5 Monitor Updates
baseurl=http://<local-op5-repo-address>/repos/op5-monitor-updates
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-op5%
Change the "baseurl" setting in all OP5 related repositories located in "/etc/yum.repos.d/"
9. Clean up all yum cache information with the following command:
# yum clean all
Scheduling repository synchronization
A tool like cron can be used to schedule synchronization of the OP5 repositories.
Below is an example script that can be placed in "/etc/cron.daily" to be executed on a daily basis:
#!/usr/bin/env bash
echo -e "\nStarting op5 repository sync at: $(date)\n"
echo "Cleaning up yum cache data"
yum clean all
cd "/var/www/html/op5"
reposync -l -r 'op5-*'
echo "Creating repository meta-data..."
for REPO in $(find /var/www/html/repos/* -iname "op5-*" -type d); do
echo "Creating repo in ${REPO}";
createrepo ${REPO};
done
Comments
0 comments
Please sign in to leave a comment.