« ubuntu 12.04 on mac mini | トップページ | Moutain Lion 対応 monsiaj »

2012年8月10日 (金)

Ubuntu 10.04 を dom-U としてインストール

当院の ORCA サーバは,Xen の dom-U として構築した Ubuntu 8.04 である。来年3月でサポートが切れるので,今年中に 10.04(Lucid) にアップデートしようと考えている。まだまだ時間はあるが,とりあえず,Xen の dom-U で Lucid を構築できるかどうかやってみた。
  1. インストールするパーティションを用意する。当院では,物理パーティションを作って構築している。今回は,自宅サーバ(ubuntu 12.04 on mac mini)の sdb6 に parted で 20GB のパーティションを作り,ext3 でフォーマットして作成してみた。
    # parted /dev/sdb
    (parted) mkpart
    Partition name?  []? lucid
    File system type?  [ext2]? ext3
    Start? 160GB
    End? 180GB
    (parted) p
    Number  Start   End     Size    File system  Name                  Flags
     1      20.5kB  210MB   210MB   fat32        EFI System Partition  boot
     2      211MB   30.0GB  29.8GB  ext3         orca
     3      30.0GB  60.0GB  30.0GB  ext3         dolphin
     4      60.0GB  90.0GB  30.0GB  ext3         samba
     5      90.0GB  160GB   70.0GB  ext3         vmz
     6      160GB   180GB   20.0GB               lucid
    (parted) quit
    # sudo mkfs.ext3 /dev/sdb6
    mke2fs 1.41.12 (17-May-2010)
    warning: 256 blocks unused.
     :
    This filesystem will be automatically checked every 25 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    
  2. debootstrap をインストールする
    # aptitude install debootstrap
    
  3. 作成した sdb6 を /mnt にマウントして,debootstrap でシステムを構築する
    # debootstrap --arch i386 lucid /mnt http://archive.ubuntu.com/ubuntu
    I: Retrieving Release
    I: Retrieving Packages
    I: Validating Packages
     :
    #
    
  4. chroot で /mnt に入り,xen のカーネルと libc をインストールする。使うカーネルは linux-image-ec2。
    # chroot /mnt
    # aptitude install linux-image-ec2 libc6-xen 
    
  5. さらに、各種設定をしてから chroot を抜ける
    # passwd
    # adduser
    # visudo
    # dpkg-reconfigure tzdata
    # aptitude insatall language-pack-ja
    # dpkg-reconfigure locales
    # exit
    
  6. カーネルを /xen-kernels/lucid/ にコピー
    $ sudo cp /mnt/boot/* /xen-kernels/lucid/
    
  7. スワップファイルの作成
    # mkdir /mnt/swap
    # dd if=/dev/zero of=/mnt/swap/swap0 bs=1K count=1M
    # chmod 600 /mnt/swap/swap0
    # mkswap /mnt/swap/swap0
    
  8. /mnt/etc/fstab の作成
    /dev/xvda1    /      ext3  errors=remount-ro       0  1
    /swap/swap0   none   swap  sw                      0  0
    proc          /proc  proc  rw,nodev,nosuid,noexec  0  0
    
  9. /mnt/etc/network/interface の作成
    auto eth0
    iface eth0 inet dhcp
    
  10. その他必要に応じてファイルを編集
    • /etc/resolv.conf
    • /etc/hostname
    • /etc/apt/sources.list
  11. /etc/xen/lucid.cfg の作成
    kernel  = '/xen-kernels/lucid/vmlinuz-2.6.32-305-ec2'
    ramdisk = '/xen-kernels/lucid/initrd.img-2.6.32-305-ec2'
    memory  = '512'
    name        = 'lucid'
    vif       = [ 'mac=00:16:3e:00:01:00' ]
    disk = [ 'phy:sdb6,xvda1,w' ]
    root = '/dev/xvda1 ro'
    on_poweroff = 'destroy'
    on_reboot = 'restart'
    on_crash = 'restart'
    
  12. /mnt をアンマウントして,lucid を立ち上げる
    # umount /mnt
    # xm create lucid.cfg -c
    Started domain lucid (id=4)
     :
    Ubuntu 10.04.4 LTS lucid tty1
    lucid login: 
    

« ubuntu 12.04 on mac mini | トップページ | Moutain Lion 対応 monsiaj »

サーバ」カテゴリの記事