1月と2月にも書いたUbuntu 9.10 (karmic koala)のノウハウ。
複数台のマシンをセットアップしたり、aptパッケージの版数を管理する必要がある場合は、リポジトリミラーを立てておいた方が良い。
基本的には
$ sudo aptitude install apt-mirrorでapt-mirrorインストールし、cron等で定期的にパブリックマスターと同期させるだけ。意外に簡単だ。
apt-mirrorの設定は/etc/apt/mirror.listで、こんな感じ。
############# config ##################通常はset defaultarch i386を設定して
#
# 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
# 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
deb http://archive.ubuntu.com/ubuntu …を列挙していけば良いが、今回はi386に加えてamd64もミラーする必要があったので、deb-i386とdeb-amd64に分けて書く必要があるというのがポイント。
設定した/var/lib/apt-mirror配下のディレクトリを作成し、
$ sudo apt-mirrorで同期開始。同期にはi386だけで50GB以上、amd64も含めると70GB以上の空き容量と、8時間ほどの時間が必要だった。
同期した後は、WebサーバのDocumentRootに/var/lib/apt-mirror/mirror/archive.ubuntu.com/ubuntuへのシンボリックリンクを作成し、Webサーバを起動すればOK。Webサーバはmini-httpdあたりで充分。
mini-httpdは/etc/mini-httpd.confのdata_dirをDocumentRootに合わせて書き直すだけかな。/etc/default/mini-httpdの
# Start daemon?を 1 にしとけば自動起動するよ。
# 0 = no
# 1 = yes
START=0
【参照】
●Ubuntu Japanese Team http://www.ubuntulinux.jp/
┗Ubuntu 9.10 Desktop 日本語 Remix CD リリース 2009年11月4日
●Ubuntu http://www.ubuntu.com/
┗KarmicKoala/ReleaseNotes/ja 2009年11月4日
●blog@browncat.org http://blog.browncat.org/
┗Ubuntu 7.10 Gutsyのリポジトリをapt-mirrorでローカルミラーするメモ 2007年10月16日
●popey.com blog http://popey.com/blog/
┗Creating an Ubuntu repository mirror with apt-mirror 2006年10月24日