Skip to content

Instantly share code, notes, and snippets.

@NQevxvEtg
Created April 9, 2026 17:18
Show Gist options
  • Select an option

  • Save NQevxvEtg/5f0e3ff68a6f40865d65409baef446d7 to your computer and use it in GitHub Desktop.

Select an option

Save NQevxvEtg/5f0e3ff68a6f40865d65409baef446d7 to your computer and use it in GitHub Desktop.
#!/bin/bash
umask 0022
MIRROR_DIR="/var/www/html/yum"
REPOS=(
# Oracle Linux 9 (and EPEL 9 for RHEL 9)
"ol9_baseos_latest"
"ol9_appstream"
"ol9_UEKR7"
"ol9_addons"
"ol9_codeready_builder"
"ol9_developer_EPEL"
# Oracle Linux 8 (and EPEL 8 for RHEL 8)
"ol8_baseos_latest"
"ol8_appstream"
"ol8_UEKR7"
"ol8_addons"
"ol8_codeready_builder"
"ol8_developer_EPEL"
# Oracle Linux 7 (and EPEL 7 for RHEL 7)
"ol7_latest"
"ol7_UEKR6"
"ol7_addons"
"ol7_optional_latest"
"ol7_developer_EPEL"
)
for REPO_ID in "${REPOS[@]}"; do
echo "Syncing $REPO_ID"
mkdir -p "${MIRROR_DIR}"
dnf reposync \
--repoid="$REPO_ID" \
--download-path="$MIRROR_DIR" \
--newest-only \
--download-metadata \
--delete
if [ $? -eq 0 ]; then
echo "$REPO_ID synced successfully"
else
echo "$REPO_ID sync failed"
fi
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment