setup local debian + backports + ubuntu mirror

first get debmirror.
# apt-get install debmirror

second, create the user mirror and su to him
# useradd -m mirror
# su – mirror
# mkdir /home/mirror/debian
# mkdir /home/mirror/debian-backports
# mkdir /home/mirror/debian-security
# mkdir /home/mirror/ubuntu

now create the default gpg keyring
# gpg –import /usr/share/keyrings/debian-archive-keyring.gpg
# gpg –keyserver hkp://subkeys.pgp.net –recv-keys 16BA136C
# gpg –keyserver hkp://subkeys.pgp.net –recv-keys 437D05B5

create links for the webserver:
# ln -s /var/www/

Create this script and put it in cron:
#!/bin/bash
debmirror –arch=i386,amd64 \
–section=main,contrib,non-free \
–host=ftp.dk.debian.org \
–dist=etch \
–root=/debian \
–progress \
–no-source \
–method=http \
/home/mirror/debian

debmirror –arch=i386,amd64 \
–section=main,contrib,non-free \
–host=security.debian.org \
–dist=etch/updates \
–root=/ \
–progress \
–no-source \
–method=http \
/home/mirror/debian-security

debmirror –arch=i386,amd64 \
–section=main \
–host=www.backports.org \
–dist=etch-backports \
–root=/debian \
–progress \
–no-source \
–method=http \
/home/mirror/debian-backports

debmirror –arch=i386,amd64 \
–section=main,restricted,universe,multiverse \
–host=nl.archive.ubuntu.com \
–dist=gutsy,gutsy-security,gutsy-updates,gutsy-backports \
–root=/ubuntu \
–progress \
–no-source \
–method=http \
/home/mirror/ubuntu

exit to root and create links for the folders to /var/www
# logout
# ln -s /home/mirror/debian /var/www/
# ln -s /home/mirror/debian-backports /var/www/
# ln -s /home/mirror/debian-security /var/www/
# ln -s /home/mirror/ubuntu /var/www/

Now run the script and wait for the packages to download.
Remember to put the script in cron after you finish downloading.

On the clients which use this mirror, add this to sources.list:

#debian etch:
deb http://mirror.sk.mcn.dk/debian/ etch main contrib non-free
deb http://mirror.sk.mcn.dk/debian-security/ etch/updates main contrib
deb http://mirror.sk.mcn.dk/debian-backports/ etch-backports main contrib non-free

#Ubuntu Gutsy:
deb http://mirror.sk.mcn.dk/ubuntu/ gutsy main restricted universe multiverse
deb http://mirror.sk.mcn.dk/ubuntu/ gutsy-updates main restricted universe multiverse
deb http://mirror.sk.mcn.dk/ubuntu/ gutsy-security main restricted universe multiverse

Dette indlæg blev udgivet i Knowledge Base, Linux, Old Base. Bogmærk permalinket.

Skriv et svar