[CentOS-mirror] How to create centos country mirror.

Gene Liverman gliverma at westga.edu
Mon Mar 28 11:48:26 UTC 2016


Here is what I use to sync CentOS and others (be sure to change your source
for syncing from SRC_GATECH to something else):

#!/bin/bash

lockfile="/var/lock/subsys/sync-repos/rsync_updates"
if [ -f ${lockfile} ]; then
echo "Updates via rsync already running."
logger -t rsync "Unable to start new repo sync, one is already running."
exit 0
fi

# Global Vars
RSYNC="`which rsync`"
OPTS="--delay-updates --delete-delay --devices --hard-links --links
--partial --perms --progress --recursive --sparse --specials --timeout=600
--times"
DST="/storage/www/repos"

# private mirror
SRC_GATECH="rsync://mirror.gtlib.gatech.edu"

# Where to grab Gentoo Portage tree from
SRC_PORTAGE="rsync://rsync.us.gentoo.org/gentoo-portage"

# run normal or verbose
if [ "$1" != "-v" ]; then
OPTS="$OPTS --quiet"
fi

if [ -d ${DST}/ ] ; then
# Note that we are doing an update right now
touch ${lockfile}
MSG="Starting sync of repos"
echo "${MSG}"
logger -t rsync "${MSG}"
# CentOS Repos
MSG="Starting sync of CentOS repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} ${SRC_GATECH}/centos/ ${DST}/CentOS/

# EPEL Repos
MSG="Starting sync of EPEL repos"
echo "${MSG}"
logger -t rsync "${MSG}"
FEDORA_OPTS="--hard-links --numeric-ids"
${RSYNC} ${OPTS} ${FEDORA_OPTS} ${SRC_GATECH}/fedora-epel/
${DST}/Fedora-EPEL/
# Update Fedora Mirror Manager
MSG="Notifying Mirror Manager of updates"
echo "${MSG}"
logger -t rsync "${MSG}"
/usr/bin/report_mirror

# ELRepo
MSG="Starting sync of ELRepo repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} rsync://elrepo.reloumirrors.net/elrepo ${DST}/ELRepo/

# Fedora
#MSG="Starting sync of Fedora repos"
        #echo "${MSG}"
        #logger -t rsync "${MSG}"
#FEDORA_OPTS="--numeric-ids"
        #${RSYNC} ${OPTS} ${FEDORA_OPTS} ${SRC_GATECH}/fedora-enchilada
${DST}/Fedora/

# Gentoo
MSG="Starting sync of Gentoo repos"
echo "${MSG}"
logger -t rsync "${MSG}"
GENTOO_OPTS="--exclude=/releases/historical"
${RSYNC} ${OPTS} ${GENTOO_OPTS} ${SRC_GATECH}/gentoo ${DST}/Gentoo

# Gentoo Portage
MSG="Starting sync of Gentoo Portage Tree"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} ${SRC_PORTAGE} ${DST}/gentoo-portage

# Linux Mint
MSG="Starting sync of Linux Mint repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} rsync://rsync-packages.linuxmint.com/packages
${DST}/LinuxMint/packages

# OpenCSW setup as suggested at http://www.opencsw.org/get-it/mirrors/
MSG="Starting sync of OpenCSW packages"
echo "${MSG}"
logger -t rsync "${MSG}"
OPENCSW_OPTS="--hard-links"
${RSYNC} ${OPTS} ${OPENCSW_OPTS} rsync://rsync.opencsw.org/opencsw/
${DST}/OpenCSW
# RPMforge
MSG="Starting sync of RPMforge repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} ${SRC_GATECH}/RPMforge/* ${DST}/RPMforge/

# Puppet Labs
MSG="Starting sync of Puppet Labs repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} rsync://yum.puppetlabs.com/packages/* ${DST}/PuppetLabs/

# Ubuntu
MSG="Starting sync of Ubuntu releases repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} ${SRC_GATECH}/ubuntu-releases/* ${DST}/Ubuntu/releases/

MSG="Starting sync of Ubuntu archive repos"
echo "${MSG}"
logger -t rsync "${MSG}"
${RSYNC} ${OPTS} ${SRC_GATECH}/ubuntu/* ${DST}/Ubuntu/archive/

# Cleanup
MSG="Syncing of repos complete"
echo "${MSG}"
logger -t rsync "${MSG}"
/bin/rm -f ${lockfile}
else
echo "Target directory ${DST}/ is not present."
logger -t rsync "Unable to sync repos, ${DST}/ is not present."
fi





--
*Gene Liverman*
Systems Integration Architect
Information Technology Services
University of West Georgia
gliverma at westga.edu

ITS: Making Technology Work for You!



On Mon, Mar 28, 2016 at 6:33 AM, Ben .T.George <bentech4you at gmail.com>
wrote:

> HI
>
> thanks for the reply,
>
> "We highly recommend the use of lock files in your cron script so that
> you don't spawn multiple connections which is hard on our servers and on
> your mirror."
>
> can anyone send me sample script?
>
> Regards,
> Ben
>
> On Wed, Mar 23, 2016 at 9:21 AM, Andrew Yong <me at ndoo.sg> wrote:
>
>>
>> On Mar 23, 2016 14:20, "Ben .T.George" <bentech4you at gmail.com> wrote:
>> >
>> > HI List,
>> >
>> > i am very new to this and we are interested in setting up country
>> mirror from kuwait location . please anyone let me know is there any
>> existing mirror from kuwait
>>
>> https://www.centos.org/download/mirrors/
>>
>> >
>> > Also help me by sending the documents/steps for setting new one.
>>
>> https://wiki.centos.org/HowTos/CreatePublicMirrors
>>
>> >
>> > Regards,
>> > Ben.
>> >
>> > _______________________________________________
>> > CentOS-mirror mailing list
>> > CentOS-mirror at centos.org
>> > https://lists.centos.org/mailman/listinfo/centos-mirror
>> >
>>
>> _______________________________________________
>> CentOS-mirror mailing list
>> CentOS-mirror at centos.org
>> https://lists.centos.org/mailman/listinfo/centos-mirror
>>
>>
>
> _______________________________________________
> CentOS-mirror mailing list
> CentOS-mirror at centos.org
> https://lists.centos.org/mailman/listinfo/centos-mirror
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-mirror/attachments/20160328/4411cddf/attachment.html>


More information about the CentOS-mirror mailing list