Skip to content

Instantly share code, notes, and snippets.

@ziozzang
Created May 16, 2019 23:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziozzang/f37f04c27cff85f093e146a27537fe81 to your computer and use it in GitHub Desktop.
Save ziozzang/f37f04c27cff85f093e146a27537fe81 to your computer and use it in GitHub Desktop.
RHEL8 Mirrors

TL;DR

  • This is example of 'how to create RHEL7/8 Subscriber's Official Repository Mirrors'

  • Code by Jioh L. Jung ziozzang@gmail.com

How to use.

  1. build docker image
  2. run docker container with sleep inf option
  3. inject command docker exec -t container_name /opt/mirror_rhel7.sh like this... generally I use with Jenkins. :)
# For RHEL8
FROM registry.access.redhat.com/ubi8
# For RHEL7
FROM registry.access.redhat.com/rhel
RUN subscription-manager register --username="id_here" --password="pass_here" --auto-attach && \
subscription-manager refresh && \
yum install -y yum-utils createrepo
#!/bin/bash
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "${BASE_DIR}"
echo ">> Moved to '${BASE_DIR}'"
mirror () {
REPO_ID="$1"
TARGET_DIR="${BASE_DIR}/${REPO_ID}"
mkdir -p ${TARGET_DIR}/${REPO_ID}
createrepo -v ${TARGET_DIR}/${REPO_ID}
reposync --gpgcheck -l \
--repoid=${REPO_ID} \
--download_path=${TARGET_DIR} \
--downloadcomps --download-metadata
createrepo -v ${TARGET_DIR}/${REPO_ID}
}
mirror "rhel-7-server-ansible-2-rpms"
mirror "rhel-7-server-ansible-2.7-rpms"
mirror "rhel-7-server-ansible-2.8-rpms"
mirror "rhel-7-server-devtools-rpms"
mirror "rhel-7-server-extras-rpms"
mirror "rhel-7-server-fastrack-rpms"
mirror "rhel-7-server-openstack-14-tools-rpms"
mirror "rhel-7-server-rh-common-rpms"
mirror "rhel-7-server-supplementary-rpms"
mirror "rhel-atomic-7-cdk-3.8-rpms"
mirror "rhel-atomic-7-cdk-3.7-rpms"
mirror "rhel-atomic-7-cdk-3.6-rpms"
mirror "rhel-server-rhscl-7-rpms"
mirror "rhel-7-server-rpms"
mirror "rhel-7-server-optional-rpms"
mirror "rhel-7-server-extras-rpms"
mirror "rhel-ha-for-rhel-7-server-rpms"
mirror "rhel-ha-for-rhel-7-server-eus-rpms"
mirror "rhel-rs-for-rhel-7-server-rpms"
mirror "rhel-rs-for-rhel-7-server-eus-rpms"
mirror "rhel-7-server-thirdparty-oracle-java-rpms"
mirror "rhel-7-server-thirdparty-oracle-java-source-rpms"
mirror "rhel-7-server-eus-rpms"
mirror "rhel-7-server-eus-rh-common-rpms"
#!/bin/bash -x
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "${BASE_DIR}"
echo ">> Moved to '${BASE_DIR}'"
mirror () {
REPO_ID="$1"
TARGET_DIR="${BASE_DIR}/${REPO_ID}"
mkdir -p ${TARGET_DIR}/${REPO_ID}
createrepo -v ${TARGET_DIR}/${REPO_ID}
reposync \
--repoid=${REPO_ID} \
-p "${TARGET_DIR}" \
--downloadcomps --download-metadata
#--gpgcheck -l
createrepo -v ${TARGET_DIR}/${REPO_ID}
}
mirror "ubi-8-baseos"
mirror "ubi-8-appstream"
mirror "rhel-8-for-x86_64-rt-rpms"
mirror "rhel-8-for-x86_64-baseos-rpms"
mirror "codeready-builder-for-rhel-8-x86_64-rpms"
mirror "rhel-8-for-x86_64-appstream-rpms"
mirror "satellite-tools-6.5-for-rhel-8-x86_64-rpms"
mirror "rhel-8-for-x86_64-highavailability-rpms"
mirror "rhel-8-for-x86_64-resilientstorage-rpms"
mirror "ansible-2.8-for-rhel-8-x86_64-rpms"
mirror "rhel-8-for-x86_64-supplementary-rpms"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment