apt-mirror를 이용해서 apt repository mirroring

$ apt-get install apt-mirror

/etc/apt/mirror.list:

# set base_path    /var/spool/apt-mirror
deb-amd64 http://apt.opscode.com precise-0.10 main testing
deb-amd64 http://apt.opscode.com quantal-0.10 main testing
deb-i386 http://apt.opscode.com precise-0.10 main testing
deb-i386 http://apt.opscode.com quantal-0.10 main testing
clean http://apt.opscode.com

deb-amd64 http://ubuntu-cloud.archive.canonical.com/ubuntu/ precise-updates/folsom main
deb-amd64 http://ubuntu-cloud.archive.canonical.com/ubuntu/ precise-proposed/folsom main
deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu/ precise-updates/folsom main
deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu/ precise-proposed/folsom main
clean http://ubuntu-cloud.archive.canonical.com/ubuntu

# ubuntu precise
deb-amd64 http://ftp.daum.net/ubuntu/ precise           main main/debian-installer multiverse universe restricted
deb-i386  http://ftp.daum.net/ubuntu/ precise           main main/debian-installer multiverse universe restricted
deb-src   http://ftp.daum.net/ubuntu/ precise           main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-updates   main main/debian-installer multiverse universe restricted
deb-i386  http://ftp.daum.net/ubuntu/ precise-updates   main main/debian-installer multiverse universe restricted
deb-src   http://ftp.daum.net/ubuntu/ precise-updates   main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-security  main main/debian-installer multiverse universe restricted
deb-i386  http://ftp.daum.net/ubuntu/ precise-security  main main/debian-installer multiverse universe restricted
deb-src   http://ftp.daum.net/ubuntu/ precise-security  main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-proposed  main main/debian-installer multiverse universe restricted
deb-i386  http://ftp.daum.net/ubuntu/ precise-proposed  main main/debian-installer multiverse universe restricted
deb-src   http://ftp.daum.net/ubuntu/ precise-proposed  main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-backports main main/debian-installer multiverse universe restricted
deb-i386  http://ftp.daum.net/ubuntu/ precise-backports main main/debian-installer multiverse universe restricted
deb-src   http://ftp.daum.net/ubuntu/ precise-backports main multiverse universe restricted

clean http://ftp.daum.net/ubuntu/

용량 확인해보자

choe@choe-pc:~$ du -sh /var/spool/apt-mirror/mirror/*
22M     /var/spool/apt-mirror/mirror/apt.opscode.com
125G    /var/spool/apt-mirror/mirror/ftp.daum.net
357M    /var/spool/apt-mirror/mirror/ubuntu-cloud.archive.canonical.com

$ sudo apt-mirror

$ ls /var/spool/apt-mirror/mirror/apt.opscode.com
$ ln -s /var/spool/apt-mirror/mirror ~/public_html/apt-mirror

$ sudo vi /etc/cron.d/apt-mirror

pxe 부팅을 위해서는...

deb-amd64 http://ftp.daum.net/ubuntu/ precise           main multiverse universe restricted main/debian-installer
deb-i386  http://ftp.daum.net/ubuntu/ precise           main multiverse universe restricted main/debian-installer
deb-src   http://ftp.daum.net/ubuntu/ precise           main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-updates   main multiverse universe restricted main/debian-installer
deb-i386  http://ftp.daum.net/ubuntu/ precise-updates   main multiverse universe restricted main/debian-installer
deb-src   http://ftp.daum.net/ubuntu/ precise-updates   main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-security  main multiverse universe restricted main/debian-installer
deb-i386  http://ftp.daum.net/ubuntu/ precise-security  main multiverse universe restricted main/debian-installer
deb-src   http://ftp.daum.net/ubuntu/ precise-security  main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-proposed  main multiverse universe restricted main/debian-installer
deb-i386  http://ftp.daum.net/ubuntu/ precise-proposed  main multiverse universe restricted main/debian-installer
deb-src   http://ftp.daum.net/ubuntu/ precise-proposed  main multiverse universe restricted
deb-amd64 http://ftp.daum.net/ubuntu/ precise-backports main multiverse universe restricted main/debian-installer
deb-i386  http://ftp.daum.net/ubuntu/ precise-backports main multiverse universe restricted main/debian-installer
deb-src   http://ftp.daum.net/ubuntu/ precise-backports main multiverse universe restricted

/var/spool/apt-mirror/var/postmirror.sh

#!/bin/bash
src_base=rsync://ftp.kaist.ac.kr/ubuntu/dists
dest_base=/var/spool/apt-mirror/mirror/ftp.daum.net/ubuntu/dists

repo="precise precise-updates precise-proposed"
arch="amd64 i386"

for _repo in $repo; do
        for _arch in $arch; do
                rsync -avz $src_base/${_repo}/main/installer-${_arch}/ $dest_base/${_repo}/main/installer-${_arch}
        done
done

apt-mirror (last edited 2012-11-16 11:41:09 by whitekid)