rhel/centos: create local repos

Title:

rhel/centos: create local repos

Author:

Douglas O’Leary <dkoleary@olearycomputers.com>

Description:

How to create local repos

Date created:

11/2013

Date updated:

11/2013

Disclaimer:

Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me…

The normal patching cycle is to patch dev, then QA, and then production moving to the next level after a suite of tests and a burn in period. If you’re using the vendor patch suite, you can’t guarantee that the patches that were installed on dev are the ones that are being installed in production as patches get added every day.

I understand there are a number of potential options to circumvent this; one of them is listed below: creating your own patch repositories.

There are also a number of ways to access the new patch repo from other systems on your network. The process below uses ftp.

  1. Install yum downloadonly, createrepo, and vsftpd, if not already done:

    yum -y install yum-downloadonly createrepo vsftpd
    
  2. Download the updates to a patch directory. Update directory name as needed.:

    mkdir -p -m 755 /ignite/repos
    yum --downloadonly --downloaddir /ignite/repos update
    
  3. Create the local repo:

    createrepo /ignite/repos
    
  4. Create the yum repository file. Update IP and directory names as needed:

    # cat backup/local.repo
    [local]
    name=local
    baseurl=ftp://192.168.122.2/pub/repos
    enabled=1
    gpgcheck=0
    
  5. OS maintenance:

    1. Enable vsftpd:

      chkconfig vsftpd on
      service vsftpd start
      
    2. Bind remount repos directory:

      mkdir -p -m 755 /var/ftp/pub/repos
      mount -bind /ignite/repos /var/ftp/pub/repos
      
    3. Set selinux context:

      chcon -R -t public_content_t /ignite/repos
      
    4. Update firewall, if required.

  6. Test with elinks: elinks ftp://localhost/pub/repos and yum repolist

  7. Initiate your patching cycle.