LS-XHL de Debian 五日目 〜debootstrap〜
Debian Lennyから、armel(kirkwood)が正式にサポートされています。
また、最新のUbuntu 9.04 jauntyでもlennyの成果を利用してarmelのサポートが行われています。
今回は、deboostrapから最小のLinuxシステムを構築する方法を説明します。
1. debootstrapの情報
Lennyはhttp://www.jp.debian.org/releases/stable/arm/
Ubuntu(9.04)はhttps://help.ubuntu.com/9.04/installation-guide/i386/linux-upgrade.html
にdebootstrapの詳細な手順が記載されています。
付加的な情報として、Ubuntuでのarmelについてhttp://www.mail-archive.com/ubuntu-mobile@lists.ubuntu.com/msg01860.htmlがあります。
2. debootstrapのインストール
debootstrapというのは、既存のUNIX/Linux環境からDebian/Ubuntuをインストールする方法です。debootstrapを利用するためにはwgetとarが必要となります。これらはBuffaloのLS-XHLの中にすでに入ってるのでこれを利用します。
Debianの場合
# pwd /root # mkdir work # cd work # wget http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.10lenny1_all.deb # ar -x debootstrap_1.0.10lenny1_all.deb # cd / # zcat /root/work/data.tar.gz | tar xv
Ubuntuの場合
# pwd /root # mkdir work # cd work # wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.13~jaunty1_all.deb # ar -x debootstrap_1.0.13~jaunty1_all.deb # cd / # zcat /root/work/data.tar.gz | tar xv
3. debootstrapの作成
debootstrapを作成するためのツールの準備ができたので、作成に入ります。
Debianの場合
# mkdir -p /mnt/disk1/debian-root # /usr/sbin/debootstrap --arch armel lenny /mnt/disk1/debian http://ftp.us.debian.org/debian ...(しばらく待つ)
Ubuntuの場合
# mkdir -p /mnt/disk1/ubuntu-root # /usr/sbin/debootstrap --arch armel jaunty /ubuntu-root/ http://ports.ubuntu.com/ubuntu-ports ...(しばらく待つ)
4. 最小のLinuxへchroot
最小のLinuxの準備ができたので、chrootしてLinuxのセットアップを行います。
以下の手順はDebian、Ubuntuで共通です。異なる部分についてはその時に述べます。
A. chrootの実行
# LANG=C chroot /mnt/disk1/(debian|ubuntu)-root /bin/bash
B. procのマウント
# mount -t proc proc /proc
C. deviceの作成
# cd /dev # MAKEDEV -v generic
D. fstabの作成
# vi /etc/fstab ============================================================================== # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 sys /sys sysfs defaults 0 0 /dev/sda1 /boot ext3 defaults,noatime 0 1 /dev/sda2 / ext3 defaults,noatime 0 0 /dev/sda3 swap swap defaults 0 0 ==============================================================================
E. タイムゾーンの設定
# dpkg-reconfigure tzdata (Asia / Tokyoを選択)
F. ネットワークの設定
eth1がキーポイントです。
# vi /etc/network/interface ================================================================================ # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. # We always want the loopback interface. # auto lo iface lo inet loopback # To use dhcp: # auto eth1 iface eth1 inet dhcp ================================================================================ # vi resolv.conf ================================================================================ nameserver <Add Your Name Server> ================================================================================
G. ホスト名の設定
好きなホスト名を付けます。以下ではls-xhlとしています。
# vi /etc/hosts ================================================================================ 127.0.0.1 ls-xhl 127.0.0.1 localhost ================================================================================ # vi /etc/hostname ================================================================================ ls-xhl ================================================================================
H. ロケールの設定
Debianの場合 # aptitude update # aptitude install locales # dpkg-reconfigure locales ================================================================================ ja_JP.ECU-JP ECU-JP ja_JP.UTF-8 UTF-8 default ja_JP.UTF-8 UTF-8 ================================================================================ Ubuntuの場合 # aptitude update # aptitude install language-pack-ja
I. SSHサーバのインストール
これが無いとログインができません。
# aptitude install openssh-server # /etc/init.d/ssh start
J. その他
/initrdディレクトリを起動後にinitrdが展開されて置かれるので、用意しておきます。
# mkdir /initrd
使いそうなソフトをインストールしておきます。(後でインストールしても構いません。)
# aptitude install psmisc less ntpdate unzip bzip2
最後にパスワードを設定します。ユーザーを追加するもの良いと思います。
# passwd
これで準備が整いました。次回は、パーティションを切り直して、initrdを編集してdebian/ubuntuからブートできるようにします。
Please Leave a Reply
TrackBack URL :