Bagaimana caranya agar server repository kita dapat singkron dengan Server mirror lain? jawabanya.. kita dapat menggunakan debmirror, rsync atau apt-mirror. dalam kesempatan kali ini saya akan mengajak kita semua untuk membuat mirror ubuntu di server milik kita sendiri. ada pun kelengkapan yang harus dimiliki adalah:
0. Koneksi Internet
1. Bandwidth yang lumayan
2. Freespace di hardisk yang banyak (usahakan 60GB)
baiklah, berikut adalah step by stepnya:
0. buat direktory mirror, saya menggunakan direktory /home/mirror
$ sudo mkdir /home/mirror && cd /home/mirror
1. Install Debmirror
$ sudo apt-get install debmirror
2. Buat direktory mirror untuk ubuntu
$ sudo mkdir ubuntu
3. silakan kopi dan salin skript di lampiran untuk proses mirroring, dan namakan dengan mirror.ubuntu.sh
dan simpan di /home/mirror/mirror.ubuntu.sh
4. ubah permisi untuk berkas tersebut
$ sudo chmod +x mirror.ubuntu.sh
5. silakan tunggu karena mirror anda sedang dibangun
6. Install webserver, anda dapat menggunakan apache2 atau lighttpd
$ sudo apt-get install apache2 # jika anda menggunakan apache
$ sudo apt-get install lighttpd # jika anda menggunakan lighttpd
7. Buat link untuk pengaksesan web agar supaya mirror kita dapat diakses dari luar
$ sudo ln -s /home/mirror/ubuntu /va/www/ubuntu
8. singkronkan selalu dengan server repository, dapat menggunakan anacron untuk melakukanya
$ sudo crontab -e
isikan dengan * 5,22,10,15 * * * cd /home/ftp && /home/mirror/mirror.ubuntu.sh
simpan dan repository akan di cek pada jam 5, 10, 15 dan 22
Selesai, mudah bukan?
Lampiran script:
#!/bin/bash
# created by Mahyuddin Susanto
# please give this file exsecution mode
# sudo chmod +x this_file.sh
# i asumsed you run this file at /home/mirror/
# type $ man debmirror for more information about debmirror
MIR=/usr/bin/debmirror
if test -e $MIR;
then
# this is most important :p
echo “Debian/Ubuntu scanning packages for own repository”
echo “Created by Mahyuddin Susanto aka udienz@ubuntu.com”
echo “Use Your Own Risk”
else
echo “Currently, package dependency is not installed on your system, please install first”
echo “using apt-get install debmirror”
exit 1
fi
# Server, lets declare your target server, you can add your nearest ubuntu mirror like jp.archive.ubuntu.com
SERVER=archive.ubuntu.com
# tellme where root server have ubuntu mirror, you can insert like: ubuntu, pub/ubuntu depends your server
# example: ubuntu mirror at foss-id like http://dl2.foss-id.web.id/ubuntu of course you can type ROOT=ubuntu
ROOT=ubuntu
# What’s your method to use mirroring? you can use http, ftp, hftp, rsync method
METHOD=http
# let’s discuss about release ubuntu, ubuntu have code name release like wathy, breezy, dapper, edgy, feisty, gutsy, hardy, intrepid
# in this case you can mirroring release ubuntu more than one release, or you can mirroring update package, security package, proposed package
# ex: $release-security so you can type hardy,hardy-updates,hardy-security,hardy-backports,hardy-proposed
RELEASE=intrepid,intrepid-updates,intrepid-security,intrepid-backports,intrepid-proposed
# section, hm… no more information here
# ubuntu section is main, restricted, universe, multiverse
# but you can add more section like debian-installer on the section
SECTION=main,restricted,universe,multiverse,main/debian-installer,restricted/debian-installer,universe/debian-installer,multiverse/debian-installer
# architecture… hm.. what architecture fo you want to mirroring? i386 (32bit), amd64 (64bit, include IA64), sparc or powerpc?
ARCHITECTURE=i386,amd64 #just it?
# okey next you must save mirror file to your directory, but you must declare on here. i save my mirror at /media/mirror/ubuntu
TARGET=ubuntu
if test -d `pwd`/$TARGET;
then EXISTS=”yes”
else
echo “it seems you don’t have ubuntu directory, create first!”
exit 1
fi
# hmm…. do you cannocted under proxy? if yes you must add –proxy=http://you-name:your_passwd@url:port
#TMPFILE=`mktemp -t mirror.surat`
#exec > “$TMPFILE”
#echo “From: \”DebMirror Ubuntu\” “root@ubuntu.nad.go.id”"
#echo “To: isikan yang akan menerima”
#echo “Cc: hadinux@gmail.com,udienz@ubuntu.com”
#echo “Subject: Minta perhatian penggunaan benwit”
#echo “”
#echo “Assalamualaikum”
#echo “”
#echo “Mohon perhatian, server sedang melakukan proses mirror repository ubuntu”
#echo “untuk itu mohon kesediaanya untuk memberi benwit pada server agar cepet selesai mirrornya”
#echo “atas perhatian dan kerjasamanya kami ucapkan terimakasih”
#echo “”
#echo `date`
#echo “wassalam”
#echo “”
#echo “Mirror dengan: $METHOD/$SERVER/$ROOT/$DISTRO $SECTION”
#echo “Untuk arsitektur $ARCHITECTURE”
#echo “Versi: $VERSION”
#echo “”
#echo “–++ DebMirror ++–”
#echo “”
#echo “———————————————————”
#cat $CHANGES_FILE
#exec
#/usr/sbin/sendmail -t -i < $TMPFILE #rm -f $TMPFILE debmirror -m --passive \ --host=$SERVER \ --root=$ROOT \ --method=$METHOD \ --progress \ --dist=$DISTRO \ --section=$SECTION \ --arch=$ARCHITECTURE \ $TARGET \ --nosource --getcontents # if you want to mirroring both of binary package and source you can delete --nosource, i'm not this option because my disk is limiitted. # and if you don't want to remove previous repositories you can add --nocleanup option # if you get error messages about gpg files maybe you forget to add gpg ubuntu archive as trusted keys
# gpg --keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import
# note: remember your free space and bandwidth