xen の Domain-U(ゲスト) に CentOS5.4をインストール

http://d.hatena.ne.jp/moogme/20091126 のつづき。


CentOSにはこのような便利なコマンドがあるので使う。

$ sudo LANG=C virt-install \
%--paravirt \
%--name=xen01 \
%--vcpus=2 \
%--ram=512 \
%--file=/dev/VolGroup00/LogVol02 \
%--location=http://ftp.riken.jp/Linux/centos/5/os/i386/ \
%--nographics \
%--nonsparse

Starting install...
Retrieving file .treeinfo...                                                |  413 B     00:00
Retrieving file vmlinuz...                                                  | 2.1 MB     00:02
Retrieving file initrd.img...                                               | 6.6 MB     00:07Creating domain...                                                          |    0 B     00:00
error: Failed to get local hostname

Domain installation still in progress. You can reconnect to
the console to complete the installation process.

なんと!

$ sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      512     2 r-----     18.8
xen01                                      1      511     2 -b----      1.6

でも、できてる。

ここ http://blog.dc-d.jp/archives/343.html を見ながら、コンソールで再開する。

$ sudo xm console xen01

*** Choose a Language 
-> Japanese
*** Configure TCP/IP
 - Enable IPv4 support
 -> Manual configuration 
 - Enable IPv6 support
 -> Automatic neighbor discovery (RFC 2461)
*** Manual TCP/IP Configuration
         | IPv4 address: 192.168.0.111___ / 255.255.255.0___          |         
         | Gateway:      192.168.0.1______________________________    |         
         | Name Server:  192.168.0.1______________________________    |         
*** Retrieving
-> Retrieving images/stage2.img...
 このあとすごく長い。。
*** Would you like to use VNC?
-> Use text mode
*** Language Unavailable 
-> OK
*** CentOS
-> OK
*** Warning
The partition table on device xvda (Xen Virtual Block Device 51199 MB)  ...
-> Yes
*** Partitioning Type
-> Yes
*** Warning 
              | You have chosen to remove all Linux partitions   |              
              | (and ALL DATA on them) on the following drives:  |              
              |                                                  |              
              | xvda (Xen Virtual Block Device 51199 MB)   
-> Yes
*** Review Partition Layout
-> Yes
*** Partitioning
 |        Device          Start    End     Size       Type     Mount Point    |  | VG VolGroup00                           51072M  VolGroup                 ^ | 
 | LV LogVol01                              1056M  swap                     : | 
 | LV LogVol00                             50016M  ext3        /            : | 
 | /dev/xvda                                                                : | 
 |   xvda1                     1      13     101M  ext3        /boot        : | 
 |   xvda2                    14    6527   51097M  physical v               : | 
-> OK
*** Boot Loader Configuration
-> OK
*** Boot Loader Configuration
-> OK
*** Boot Loader Configuration
-> OK
*** Boot Loader Configuration
-> OK
*** Boot Loader Configuration
-> OK
*** Configure Network Interface
-> OK
*** Network Configuration for eth0
                      |     [*] Activate on boot         |                      
                      |     [*] Enable IPv4 support      |                      
                      |     [ ] Enable IPv6 support      |   
-> OK
*** IPv4 Configuration for eth0
-> OK
*** Miscellaneous Network Settings
-> OK
*** Hostname Configuration
      |       (*) manually               ao-xen01.moog.me________        |      
-> OK
*** Time Zone Selection
[ ] System clock uses UTC
Asia/Tokyo
-> OK
*** Root Password
                | Password:           ***********_____________ |                
                | Password (confirm): ***********_____________ |           
*** Package selection
      |                    [*] Server             ^                     |       

      |                [*] Customize software selection                 |       
*** Package Group Selection 
追加した。
               |   [*] Development Libraries               :   |                
               |   [*] Development Tools                   :   | 
削除した。
               |   [ ] FTP Server                          :   |                
               |   [ ] GNOME Desktop Environment           :   |   
               |   [ ] Games and Entertainment             :   |                
               |   [ ] Graphical Internet                  #   |                
               |   [ ] Graphics                            :   |       
               |   [ ] Java                                :   |                
               |   [ ] News Server                         :   |                
               |   [ ] Office/Productivity                 :   |                
               |   [ ] Printing Support                    :   |                
               |   [ ] Sound and Video                     #   |                
               |   [ ] Windows File Server                 :   |                
               |   [ ] X Window System                     v   |                
               |   [ ] Dialup Networking Support           :   |                
                
Development 系にチェックを入れて、あと、いくつかはチェックを外した。
*** Installation to begin
-> OK
*** Package Installation
終わるまで待つ。
***  Complete 
-> Reboot


あれ、親のコンソールに戻った。

$ sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      512     2 r-----     20.9

しかも、xen01がない。


起動

$ sudo xm create xen01
Using config file "/etc/xen/xen01".
Started domain xen01

$ sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      512     2 r-----     22.4
xen01                                      2      511     2 -b----     6.4

OK!


あとは普通にsshできる

$ ssh root@192.168.0.111

すばらしい。



参考にさせて頂きました。
http://tomo.ac/goodstream/xen/centos5/index.html
http://blog.dc-d.jp/archives/343.html
http://linux.die.net/man/1/virt-install




つづく
http://d.hatena.ne.jp/moogme/20091128