Internal RHEL/CentOS repo for yum Overview
The main goal for setting up internal yum repo (or mirror) servers is having more control and consistency over the software deployed within a RHEL/CentOS Linux environment. The process we used prior to using internal repos was much more ad-hoc, causing discrepancies with test server software versions and production server software versions. While a practice of upgrading test servers prior to production servers was in place, trying to manage versions at the endpoint was troublesome and tedious. Managing versions at the source is far more efficient in the long run, plus the other added benefits of having a local yum repo.
In the quest to find something to manage Linux software on test and production servers, I found myself looking into tools like Katello and SpaceWalk to implement local yum repositories for RHEL and CentOS. However, I found those tools to be much more tool than what was really needed. The end result is a simple file download stored on local servers. the downloaded files are then served up through http and configured. I will walk through setting up local repositories for Redhat 6, Redhat 7, CentOS 6, and CentOS 7, along with a local copy of EPEL for each OS version. The first thing to get sorted is building the servers.
System Build Overview
Building the servers that will be used for the internal yum repository mirrors is fairly strait forward. The biggest consideration is the amount of disk space that will be needed and what OS to install. If you are wanting to build an internal repo for Redhat servers then the repo server needs to be Redhat. For our purposes, there will be one RHEL6 server and one RHEL7 server. The RHEL6 server, will also host the CentOS6 repo data along with the EPEL6 data. The same goes for the RHEL7 server, it will house the CentOS7 data along with the EPEL7 data. Another small sticking point to doing it this way is one will need a separate RHEL server for EACH OS version you plan to setup a mirror for.
For RHEL6 storage nodes
vg_local-lv_root mount on / minimum of 10240MB vg_local-lv_home mount on /home minimum of 15360MB up to whatever size vg_local-lv_tmp mount on /tmp minimum of 1024MB vg_local-lv_usr mount on /usr minimum of 4096MB vg_local-lv_var mount on /var minimum of 100000MB(100GB's) up to whatever size
For RHEL7 storage nodes
vg_local-lv_root mount on / minimum of 10240MB vg_local-lv_home mount on /home minimum of 15360MB up to whatever size vg_local-lv_tmp mount on /tmp minimum of 1024MB vg_local-lv_usr mount on /usr minimum of 4096MB vg_local-lv_var mount on /var minimum of 60000MB(60GB's) up to whatever size
Install prerequisite apps
Setup Note: Some services should be available on the network such as a timeserver and DNS services otherwise, some assumptions made throughout this document will not be correct. It should also be noted that turning off SElinux and the firewall is not necessary for any part of this guide.
Setup Note: RHEL servers must be subscribed to receive updates through the Subscription-Manager
yum install httpd
yum install createrepo
yum install lftp
yum install perl
Install helpful utilities
yum install wget
yum install lsof
yum install mlocate
yum install sudo
yum install policycoreutils-python
yum install yum-utils
Everything on one line
yum install httpd createrepo lftp perl wget lsof mlocate sudo policycoreutils-python yum-utils
Upgrade all packages if it has not been done yet
Reboot the system
shutdown -r now