CentOS - Set up Your Own Mirror

By setting up your own repository you can install CentOS with a netinstall ISO incredibly quickly. In fact, when combined with a kickstart script, I have found that a full install can be set up in less than 1 minute!

This post is aimed at UK netizens (using UK repos), but you can easily change the paths to the repos you pull from a location closer to you.

Steps

    First you will need to set up a webserver, so that people can browse to your mirror over http:
    yum install httpd
    Create a directory where you want your downloaded files to go into. Please note, this directory needs to be accessible from your webserver, so either make sure to use a directory within the webservers default directory, or reconfigure your apache configuration
    rsync -avrt --delete --exclude "isos" --copy-links \
    rsync://mirrorservice.org/mirror.centos.org/ $PATH_TO_STORAGE_DIR
    

    Please note, that for the 5/ and 6/ directories to work (which always point to the latest release, then the --copy-links absolutely has to be in that instruction. To only sync these

    If you just want certain directories, it may be easier to run multiple commands like so:

    rsync -avrt --delete --exclude "isos" --copy-links \
    rsync://mirrorservice.org/mirror.centos.org/6/ [LOCAL-DIRECTORY-PATH]/6/

    rsync -avrt --delete --exclude "isos" --copy-links \
    rsync://mirrorservice.org/mirror.centos.org/5/ [LOCAL-DIRECTORY-PATH]/5/

No comments:

Post a Comment