Skip to content

Instantly share code, notes, and snippets.

@sebastiaanfranken
Created October 18, 2018 18:43
Show Gist options
  • Save sebastiaanfranken/0088c2248f9c3d92ac3e015465c139f4 to your computer and use it in GitHub Desktop.
Save sebastiaanfranken/0088c2248f9c3d92ac3e015465c139f4 to your computer and use it in GitHub Desktop.
Update a yum mirror with reposync and createrepo
#!/bin/bash
# Which repos should we sync? You can edit this list to your
# hearts content. The values it accepts can be checked with
# the "$ yum repolist" command. Make sure you have yum-utils
# installed, first.
REPOS="base updates extras epel"
# Loop over the repos defined above and reposync them all,
# followed by a createrepo.
for REPO in $REPOS; do
/usr/bin/reposync --repoid=$REPO -g -l -n -p /var/www/html/repos/centos/7/
/usr/bin/createrepo /var/www/html/centos/7/$REPO
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment