オレオレDebian サーバをセットアップする#2(失敗)

目的

いつでも同じ構成のサーバを作れること

ターゲット

準備(x86)

まずは x86 で検証する.

Debian 5.0.1 をインストール
  • 基本システムのみ
必要パッケージの取得
$ su -
# apt-get install sudo openssh-server
# apt-get install equivs
インストール後の処理
$ wget http://rubyforge.org/frs/download.php/55510/ruby-enterprise_1.8.6-20090421_i386.deb
$ sudo dpkg -i ruby-enterprise_1.8.6-20090421_i386.deb
# /opt/ruby-enterprise/bin/gem update

CD作成

DebianCustomCD - Debian Wikiを参考に.

必要パッケージのダウンロード
$ sudo apt-get install openssh-server build-essentials sudo
apt-moveで移動
$ sudo apt-get install apt-move
$ sudo apt-move get
$ sudo apt-move move
netinst CDからコピー
$ sudo mount /media/cdrom
$ mkdir ~/work/pool
$ cd ~/work
$ cp -rf /media/cdrom/pool/ ./
apt-moveからコピー
$ sudo cp -rf /mirrors/debian/pool/ ./
debianinstaller バイナリを取得

debian-installer を buildします.

$ apt-get source debian-installer
$ cd debian-installer-20090123lenny1/
$ sudo apt-get build-dep debian-installer
$ dpkg-checkbuilddeps
$ make reallyclean
$ fakeroot make build_netboot
udeb ファイルをコピー

wikiにあるサンプルスクリプトではうまく動きませんでした.と言うか,パイプが OR (| -> ||) になってたり,awk の書き方が変なんですが,どうなってるんだろ.

と言うわけで修正版がこちら

$ home move_installer_udebs.sh /home/ogawa/debian-installer-20090123lenny1/build/apt.udeb/cache/archives /home/ogawa/work

ここでの注意点は,パス指定の最後のスラッシュは外すこと.わりとハマりました.

indicesをダウンロード

http://ftp.debian.org/debian/indices/ にある下記のファイルをダウンロード.

override.lenny.contrib.gz
override.lenny.contrib.src.gz
override.lenny.extra.contrib.gz
override.lenny.extra.main.gz
override.lenny.extra.non-free.gz
override.lenny.main.gz
override.lenny.main.src.gz
override.lenny.non-free.gz
override.lenny.non-free.src.gz

展開前後のファイル両方必要らしいので,コピー -> 展開 -> コピーとする.

$ cd ~/source
$ mkdir indices
$ wget http://ftp.debian.org/debian/indices/override.lenny.contrib.gz
....
$ mkdir ~/work/indices
$ cp -r ~/source/indices/* ~/work/indices/
$ cd ~/work/indices/
$ gunzip -d *.gz
$ cp -r ~/source/indices/* ~/work/indices/
パッケージリストとリリースファイルの生成
$ vim ~/apt.conf
$ vim ~/my-lenny-di.conf
  • apt-ftparchiveを実行
$ cd ~/work
$ apt-ftparchive -c ~/apt.conf generate ~/my-lenny-di.conf
$ vim ~/my-cd.conf
  • apt-ftparchiveを実行
apt-ftparchive -c ~/apt.conf generate ~/my-cd.conf
  • apt-ftparchiveを実行
$ apt-ftparchive -c ~/apt.conf generate ~/my-cd.conf
CDの作成

以上でインストールCDができたので,これを ISO イメージすればOKらしい.ただ方針を少し変えたので,これはこのままにして,#1の続きに戻ることにする.