サーバ用途としてのInstall手順 2007.0 stage3
以下の環境にInstall
hp d325
CPU: AthlonXP 2400+
HDD: UATA100 40GB
Mem: DDR333 512MB(256MBx2)
Chipset: NVIDIA® nForce™ 2
下準備
サーバ用途なので、パラレル・シリアル及びオーディオは必要ないのでDisableにする。
今回はLiveCD+Networkインストールを行うのでGentooのサイトからLiveCD 2007.0をDLしてCDに焼く。
なのでネットワークインフラの用意も。
起動後の状態確認
ネットに繋がるかどうかを確認。
dhcp環境にもかかわらず、接続できない・アドレス割り当てがされていない場合は
dmesgでEthが認識されているか確認。
また、/etc/init.d/net.eth0 restartを試してみる。
手動の場合は任意。
Rootパスワードの設定
livecd ~ # passwd root
stageの展開
livecd ~ # cd /mnt/gentoo
livecd gentoo # wget ftp://rsync4.jp.gentoo.org/GENTOO/releases/x86/current/stages/stage3-x86-2007.0.tar.bz2
livecd gentoo # tar -xvjf stage3-x86-2007.0.tar.bz2
Gentooシステムのマウント
livecd gentoo # mkdir /mnt/gentoo/proc
livecd gentoo # mount -t proc none /mnt/gentoo/proc
livecd gentoo # cp /etc/resolv.conf /mnt/gentoo/etc/
livecd gentoo # chroot /mnt/gentoo /bin/bash
livecd / # env-update && source /etc/profile
System Install
livecd / # emerge --sync
livecd / # emerge -e system <- 5時間程度
#stage3でのInstallの為、bootstrap.shの実行は不要#
Localtimeの設定
livecd / # cp /usr/share/zoneinfo/Japan /etc/localtime
KernelInstall
livecd ~ # emerge gentoo-sources
livecd ~ # cd /usr/src/linux
livecd linux # make menuconfig
編集内容を確認する。
eth0を認識しないかもしれないのでDriver項目は要チェック。他はデフォルトでOK
livecd linux # make && make modules_install
livecd linux # cp arch/i386/boot/bzImage /boot/kernel
fstabの編集
livecd linux # nano /etc/fstab
パーティション区分にあわせて適宜設定。
(今回は/dev/hda1(ext3)のみだったのでそれを/rootに設定し、それ以外は特に未定義)??時折、"mount -l"や、"df"コマンドをつかってもマウントテーブルが読み込めません的なエラーが出力されてしまう。
それを回避するためには/proc/mountsから/etc/mtabへリンクを張り、mountコマンド使用時に-nオプションを使用するようにするといいとのこと。
(なので、/etc/init.d内のlocalmountなんかに入っているmountコマンド部分のオプションに-nを追記してやる必要がある)
livecd linux # rm /etc/mtab
livecd linux # ln -s /proc/mounts /etc/mtab
Grub Install
livecd linux # emerge grub
livecd linux # grub#Grubコマンドラインがでてくるので
root (hd0,0)
setup (hd0)
とすればOK(MBRをhd0に書き込む)livecd linux # nano /boot/grub/grub.conf
timeout 30
fallback 1
splashimage=(hd0,0)/boot/grub/splash.xpm.gztitle=Gentoo Linux
root (hd0,0)
kernel /boot/kernel
この時点でmountしてる/dev/hdaやらprocをumountしてしまって再起動しても普通に起動すると思います。
最悪しなかったとしても、Livecdで起動→
# mount /dev/hda1 /mnt/gentoo
# mount proc -t none /mnt/gentoo/proc
# chroot /mnt/gentoo /bin/bash
# env-update && source profile
で、再開可能。