Archive: 2010/03/06

Ubuntuのリポジトリミラー

1月2月にも書いたUbuntu 9.10 (karmic koala)のノウハウ。

複数台のマシンをセットアップしたり、aptパッケージの版数を管理する必要がある場合は、リポジトリミラーを立てておいた方が良い。

基本的には

$ sudo aptitude install apt-mirror
apt-mirrorインストールし、cron等で定期的にパブリックマスターと同期させるだけ。意外に簡単だ。

apt-mirrorの設定は/etc/apt/mirror.listで、こんな感じ。

############# config ##################
#
# set base_path /var/lib/apt-mirror
#
# if you change the base path you must create the directories below with write privileges
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch architecture>
# set postmirror_script $var_path/postmirror.sh

set base_path /var/lib/apt-mirror
set mirror_path $base_path/mirror
set skel_path $base_path/skel
set var_path $base_path/var
set cleanscript $var_path/clean.sh
#set defaultarch i386
set postmirror_script $var_path/postmirror.sh

set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############

deb-i386 http://archive.ubuntu.com/ubuntu karmic main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
#deb-i386 http://archive.ubuntu.com/ubuntu karmic-proposed main restricted universe multiverse
#deb-i386 http://archive.ubuntu.com/ubuntu karmic-backports main restricted universe multiverse

deb-amd64 http://archive.ubuntu.com/ubuntu karmic main restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
#deb-amd64 http://archive.ubuntu.com/ubuntu karmic-proposed main restricted universe multiverse
#deb-amd64 http://archive.ubuntu.com/ubuntu karmic-backports main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu karmic main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic-backports main restricted universe multiverse

clean http://archive.ubuntu.com/ubuntu
通常はset defaultarch i386を設定して
deb http://archive.ubuntu.com/ubuntu …
を列挙していけば良いが、今回はi386に加えてamd64もミラーする必要があったので、deb-i386deb-amd64に分けて書く必要があるというのがポイント。