ゲストOSインストール(CentOS5編)

最終更新日: 2014.02.19

<<トップページ <<新着情報 <<サイト内検索 <<CentOSで自宅サーバー構築 <<Scientific Linuxで自宅サーバー構築

■概要

Fedoraで構築した管理OS(ドメイン0)上にCentOS5をゲストOS(ドメインU)としてインストールする。
ここでは、仮想マシンインストールスクリプトを利用して、ドメイン0上の仮想ディスクイメージ上にCentOS5をインストールする。

Xen導入済であること
※ホスト名、ドメイン名、IPアドレス等は各自の環境に合わせて置き換えること

■ドメインUインストール

[root@fedora ~]# yum -y install libxml2-python ← virt-installに必要なlibxml2-pythonインストール

[root@fedora ~]# virt-install --nographics ← 仮想マシンインストール開始
What is the name of your virtual machine? CentOS5 ← 任意の仮想マシン名(例:CentOS5)を応答
 How much RAM should be allocated (in megabytes)? 1024 ← 仮想マシンへ割当てるメモリ量応答(単位:MB)※
※ドメイン0上のメモリに仮想マシンに割当てる分の空きが必要
 What would you like to use as the disk (path)? /var/lib/xen/images/CentOS5.img
  ← 仮想マシンインストール先仮想ディスクイメージファイル名応答
 How large would you like the disk (/var/lib/xen/images/CentOS5.img) to be (in gigabytes)? 8
  ← 仮想マシンインストール先仮想ディスクイメージファイルサイズ応答※
※ファイルサイズは任意だが、最低でも2GBくらいは必要
 What is the install location? http://ftp.riken.jp/Linux/centos/5/os/i386/ ← 仮想マシンインストールパッケージ取得先応答

Starting install...

テキストモード(英語)による通常のインストールが開始する
※カーソル移動はTABキー、カーソルキーで、選択はSPACEキーで、決定はENTERキー押下

Welcome to CentOS
+---------+ Choose a Language +---------+
|                                       |
| What language would you like to use   |
| during the installation process?      |
|                                       |
|       Catalan                ^        |
|       Chinese(Simplified)    :        |
|       Chinese(Traditional)   #        |
|       Croatian               :        |
|       Czech                  :        |
|       Danish                 :        |
|       Dutch                  :        |
|       English                v        |
|                                       |
|                +----+                 |
|                | OK |                 |
|                +----+                 |
|                                       |
+---------------------------------------+
デフォルト(English)のままOK※Japaneseを選択しても英語になる

+----------------+ Configure TCP/IP +----------------+
|                                                    |
| [*] Enable IPv4 support                            |
|        ( ) Dynamic IP configuration (DHCP)         |
|        (*) Manual configuration                    |
|                                                    |
| [_] Enable IPv6 support                            |
|        (*) Automatic neighbor discovery (RFC 2461) |
|        ( ) Dynamic IP configuration (DHCP)         |
|        ( ) Manual configuration                    |
|                                                    |
|          +----+                  +------+          |
|          | OK |                  | Back |          |
|          +----+                  +------+          |
|                                                    |
|                                                    |
+----------------------------------------------------+
Enable IPv4 supportを選択
Manual configurationを選択
Enable IPv6 supportの選択を解除してOK

+--------------+ Manual TCP/IP Configuration +---------------+
|                                                            |
| Enter the IPv4 and/or the IPv6 address and prefix          |
| (address / prefix).  For IPv4, the dotted-quad netmask     |
| or the CIDR-style prefix are acceptable. The gateway and   |
| name server fields must be valid IPv4 or IPv6 addresses.   |
|                                                            |
| IPv4 address: 192.168.1.30____ / 255.255.255.0___          |
| Gateway:      192.168.1.1______________________________    |
| Name Server:  192.168.1.1______________________________    |
|                                                            |
|            +----+                      +------+            |
|            | OK |                      | Back |            |
|            +----+                      +------+            |
|                                                            |
|                                                            |
+------------------------------------------------------------+
IPv4 addressにサーバーのプライベートIPアドレス/ネットマスクを入力
GatewayにルーターのIPアドレスを入力
Name ServerにルーターのIPアドレスを入力してOK

+------------------+ CentOS +-------------------+
|                                               |
| Welcome to CentOS!                            |
|                                               |
|                                               |
|                    +----+                     |
|                    | OK |                     |
|                    +----+                     |
|                                               |
|                                               |
+-----------------------------------------------+
OK

+-----------------+ Warning +-----------------+
|                                             |
| The partition table on device xvda was      |
| unreadable. To create new partitions it     |
| must be initialized, causing the loss of    |
| ALL DATA on this drive.                     |
|                                             |
| This operation will override any previous   |
| installation choices about which drives     |
| to ignore.                                  |
|                                             |
| Would you like to initialize this drive,    |
| erasing ALL DATA?                           |
|                                             |
|        +-----+               +----+         |
|        | Yes |               | No |         |
|        +-----+               +----+         |
|                                             |
+---------------------------------------------+
Yes

+-------------------------+ Partitioning Type +-------------------------+
|                                                                       |
|    Installation requires partitioning of your hard drive.  The        |
|    default layout is reasonable for most users.  You can either       |
|    choose to use this or create your own.                             |
|                                                                       |
| Remove all partitions on selected drives and create default layout.   |
| Remove linux partitions on selected drives and create default layout. |
| Use free space on selected drives and create default layout.          |
| Create custom layout.                                                 |
|                                                                       |
|       Which drive(s) do you want to use for this installation?        |
|                              [*] xvda ^                               |
|                                       #                               |
|                                                                       |
|                          +----+   +------+                            |
|                          | OK |   | Back |                            |
|                          +----+   +------+                            |
|                                                                       |
+-----------------------------------------------------------------------+
Remove all partitions on selected drives and create default layout.を選択してOK

+----------------+ Warning +-----------------+
|                                            |
| You have chosen to remove all partitions   |
| (ALL DATA) on the following drives:        |
|                                            |
| /dev/xvda                                  |
|                                            |
| Are you sure you want to do this?          |
|                                            |
|        +----+              +-----+         |
|        | No |              | Yes |         |
|        +----+              +-----+         |
|                                            |
|                                            |
+--------------------------------------------+
Yes

+-------+ Review Partition Layout +-------+
|                                         |
| Review and modify partitioning layout?  |
|                                         |
|       +-----+             +----+        |
|       | Yes |             | No |        |
|       +-----+             +----+        |
|                                         |
|                                         |
+-----------------------------------------+
No

+------------------+ Low Memory +------------------+
|                                                  |
| As you don't have much memory in this machine,   |
| we need to turn on swap space immediately. To    |
| do this we'll have to write your new partition   |
| table to the disk immediately. Is that OK?       |
|                                                  |
|         +-----+                  +----+          |
|         | Yes |                  | No |          |
|         +-----+                  +----+          |
|                                                  |
|                                                  |
+--------------------------------------------------+
Yes※ドメインU割当てメモリ量が少ない場合のみ表示される警告

+-----------------+ Network Configuration for eth0 +-----------------+
|                                                                    |
| Description: Xen Virtual Ethernet                                  |
| Hardware Address: 00:16:3E:7A:AD:9B                                |
|                                                                    |
| [ ] Use dynamic IP configuration (DHCP)                            |
| [*] Enable IPv4 support                                            |
| [ ] Enable IPv6 support                                            |
| [*] Activate on boot                                               |
|                                                                    |
|                        Address                    Prefix (Netmask) |
| IPv4: 192.168.1.30_____________________________ / 255.255.255.0___ |
| IPv6: _________________________________________ / ________________ |
|                                                                    |
|             +----+                          +------+               |
|             | OK |                          | Back |               |
|             +----+                          +------+               |
+--------------------------------------------------------------------+
OK

+------------+ Miscellaneous Network Settings +------------+
|                                                          |
| Gateway:       192.168.1.1______________________________ |
| Primary DNS:   192.168.1.1______________________________ |
| Secondary DNS: _________________________________________ |
|                                                          |
|           +----+                     +------+            |
|           | OK |                     | Back |            |
|           +----+                     +------+            |
|                                                          |
|                                                          |
+----------------------------------------------------------+
OK

+--------------------+ Hostname Configuration +---------------------+
|                                                                   |
| If your system is part of a larger network where hostnames are    |
| assigned by DHCP, select automatically via DHCP. Otherwise,       |
| select manually and enter in a hostname for your system. If you   |
| do not, your system will be known as 'localhost.'                 |
|                                                                   |
|        ( ) automatically via DHCP                                 |
|        (*) manually               centosU.centossrv.com___        |
|                                                                   |
|             +----+                          +------+              |
|             | OK |                          | Back |              |
|             +----+                          +------+              |
|                                                                   |
|                                                                   |
+-------------------------------------------------------------------+
ホスト名を入力してOK

+-------+ Time Zone Selection +-------+
|                                     |
| What time zone are you located in?  |
|                                     |
| [_] System clock uses UTC           |
|                                     |
|  Asia/Tashkent                   ^  |
|  Asia/Tbilisi                    :  |
|  Asia/Tehran                     #  |
|  Asia/Thimphu                    :  |
|  Asia/Tokyo                      v  |
|                                     |
|      +----+          +------+       |
|      | OK |          | Back |       |
|      +----+          +------+       |
|                                     |
+-------------------------------------+
System clock uses UTCの選択解除
Asia/Tokyoを選択してOK

+--------------+ Root Password +---------------+
|                                              |
| Pick a root password. You must type it       |
| twice to ensure you know what it is and      |
| didn't make a mistake in typing. Remember    |
| that the root password is a critical part    |
| of system security!                          |
|                                              |
| Password:           ***********_____________ |
| Password (confirm): ***********_____________ |
|                                              |
|        +----+               +------+         |
|        | OK |               | Back |         |
|        +----+               +------+         |
|                                              |
|                                              |
+----------------------------------------------+
Password:にrootパスワードを入力
Password (confirm):にrootパスワードを入力してOK

+----------------------+ Package selection +----------------------+
|                                                                 |
| The default installation of CentOS includes a set of software   |
| applicable for general internet usage. What additional tasks    |
| would you like your system to include support for?              |
|                                                                 |
|                    [_] Desktop - Gnome    ^                     |
|                    [ ] Desktop - KDE      #                     |
|                    [ ] Server             :                     |
|                    [ ] Server - GUI       v                     |
|                                                                 |
|                [*] Customize software selection                 |
|                                                                 |
|             +----+                        +------+              |
|             | OK |                        | Back |              |
|             +----+                        +------+              |
|                                                                 |
|                                                                 |
+-----------------------------------------------------------------+
Desktop - Gnomeの選択解除
Customize software selectionを選択してOK

+----------+ Package Group Selection +----------+
|                                               |
| Please select the package groups you would    |
| like to have installed.                       |
|                                               |
|       [ ] Administration Tools        ^       |
|       [ ] Authoring and Publishing    #       |
|       [ ] Development Libraries       :       |
|       [*] Development Tools           #       |
|       [ ] Dialup Networking Support   :       |
|       [ ] Editors                     :       |
|       [ ] Emacs                       :       |
|       [ ] Engineering and Scientific          |
|                                               |
|        +----+                +------+         |
|        | OK |                | Back |         |
|        +----+                +------+         |
|                                               |
+-----------------------------------------------+
Development Toolsのみ選択してOK

+---------+ Installation to begin +----------+
|                                            |
| A complete log of your installation will   |
| be in /root/install.log after rebooting    |
| your system. You may want to keep this     |
| file for later reference.                  |
|                                            |
|       +----+              +------+         |
|       | OK |              | Back |         |
|       +----+              +------+         |
|                                            |
|                                            |
+--------------------------------------------+
OK

※大量のパッケージダウンロード&インストールを行なうため時間がかかる

+----------------------+ Complete +-----------------------+
|                                                         |
| Congratulations, your CentOS installation is complete.  |
|                                                         |
| Remove any media used during the installation process   |
| and press <Enter> to reboot your system.                |
|                                                         |
|                                                         |
|                       +--------+                        |
|                       | Reboot |                        |
|                       +--------+                        |
|                                                         |
|                                                         |
+---------------------------------------------------------+
Reboot

Setup AgentはExit※初回起動時のみ

CentOS release 5 (Final)
Kernel 2.6.18-8.1.15.el5xen on an i686

centosU.centossrv.com login: 

■ドメインU確認

CentOS release 5 (Final)
Kernel 2.6.18-8.1.15.el5xen on an i686

centosU.centossrv.com login:  ← rootユーザでログイン
Password:  ← rootパスワード応答

[root@centosU ~]# ping -c 4 www.linux.or.jp ← ネットワーク疎通確認
PING mizuho.linux.or.jp (210.171.226.47) 56(84) bytes of data.
64 bytes from mizuho.linux.or.jp (210.171.226.47): icmp_seq=1 ttl=58 time=13.3 ms
64 bytes from mizuho.linux.or.jp (210.171.226.47): icmp_seq=2 ttl=58 time=13.8 ms
64 bytes from mizuho.linux.or.jp (210.171.226.47): icmp_seq=3 ttl=58 time=13.8 ms
64 bytes from mizuho.linux.or.jp (210.171.226.47): icmp_seq=4 ttl=58 time=13.4 ms

CTRL+]キー押下 ← ドメインUコンソールから切断

[root@fedora ~]#  ← ドメイン0に戻った

[root@fedora ~]# virsh list ← ドメインの一覧を表示
 Id 名前               状態
----------------------------------
  0 Domain-0             実行中
  2 CentOS5              ブロックされています

[root@fedora ~]# virsh console CentOS5 ← ドメインUコンソールへ接続

空ENTER

[root@centosU ~]#  ← ドメインUに接続した

[root@centosU ~]# halt ← ドメインU停止

または

[root@fedora ~]# virsh shutdown CentOS5 ← ドメイン0からvirshコマンドで停止

■ドメインU自動起動設定

[root@fedora ~]# vi /var/lib/xend/domains/`virsh domuuid CentOS5`/config.sxp ← ドメインU設定ファイル編集
    (on_xend_start ignore)
    ↓
    (on_xend_start start) ← Xen起動時に起動



■関連コンテンツ




▲このページのトップへ戻る

プライバシーポリシー