To save download time and bandwidth every time I install a fresh CentOS system.
I use the cuhk mirror at:
ftp://ftp.cuhk.edu.hk/pub/Linux/centos/
Create this tree structure:
mkdir -p /mnt/usbdisk/centos/updates/ mkdir -p /mnt/usbdisk/centos/extras/ mkdir -p /mnt/usbdisk/centos/epel/
Run this script using cron.
#!/bin/bash
# mirror the updates from cuhk centos mirror
MIRROR_DIR=/mnt/usbdisk/centos
if [ ! -d "$MIRROR_DIR" ] ; then
echo "Local mirror directory does not exist."
exit 1
fi
cd $MIRROR_DIR
lftp -f $MIRROR_DIR/centos.lftp
open ftp://ftp.cuhk.edu.hk/pub/Linux/centos/5/ mirror --delete --no-symlinks updates/i386 updates mirror --delete --no-symlinks extras/i386 extras open ftp://ftp.riken.jp/Linux/fedora/epel/5/ mirror --delete --no-symlinks i386 epel
Add these to nginx config:
location /centos {
root /mnt/usbdisk/;
autoindex on;
allow 192.168.0.0/16;
deny all;
}
Set in yum repo config
[updates] baseurl=http://<server_ip>/centos/updates/ ... [extras] baseurl=http://<server_ip>/centos/extras/ ... [epel] baseurl=http://<server_ip>/centos/epel/ ...