Tutorial Instalasi Virtualization menggunakan XEN

Tahap instalasi Virtualization menggunakan XEN

Cek dahulu group yang ada di repo server anda
# yum grouplist
Authoring and Publishing
............. dihilangkan
KVM
News Server
OpenFabrics Enterprise Distribution
Virtualization
X Software Development

Hasil yum grouplist terdapat grouplist Virtualization, nah sekarang install virtualization itu dengan perintah
# yum groupinstall Virtualization -y

akan muncul list2 yang akan diinstall seperti :
Installing:
......... dihilangkan

Virtualization-en-US noarch 5.2-11 VT 1.7 M
gnome-applet-vm i386 0.1.2-1.el5 VT 75 k
kernel-xen i686 2.6.18-164.1.gls.el5 Updates 17 M
libvirt i386 0.6.3-20.el5 VT 1.9 M
virt-manager i386 0.6.1-8.el5 VT 1.5 M
virt-viewer i386 0.0.2-3.el5 VT 25 k
xen i386 3.0.3-94.el5 VT 1.9 M
Installing for dependencies:
SDL i386 1.2.10-8.el5 base 233 k
bridge-utils i386 1.1-2 base 28 k
cyrus-sasl-md5 i386 2.1.22-5.el5 base 45 k
gnome-python2-gnomekeyring i386 2.16.0-3.el5 base 16 k
gtk-vnc i386 0.3.8-3.el5 base 80 k
gtk-vnc-python i386 0.3.8-3.el5 base 12 k
iscsi-initiator-utils i386 6.2.0.871-0.10.el5 base 773 k
libvirt-python i386 0.6.3-20.el5 VT 132 k
python-virtinst noarch 0.400.3-5.el5 VT 378 k
xen-libs i386 3.0.3-94.el5 base 154 k

Transaction Summary

opsi (-y) berarti otomatis install apabila semua daftar paket sudah terinstall dan mulai mendownload.

Pastikan langkah ini selesai dilakukan dengan munculnya pesan
Dependency Installed:
SDL.i386 0:1.2.10-8.el5 bridge-utils.i386 0:1.1-2 cyrus-sasl-md5.i386 0:2.1.22-5.el5
gnome-python2-gnomekeyring.i386 0:2.16.0-3.el5 gtk-vnc.i386 0:0.3.8-3.el5 gtk-vnc-python.i386 0:0.3.8-3.el5
iscsi-initiator-utils.i386 0:6.2.0.871-0.10.el5 libvirt-python.i386 0:0.6.3-20.el5 python-virtinst.noarch 0:0.400.3-5.el5
xen-libs.i386 0:3.0.3-94.el5

Complete!

Sekarang saatnya kita merubah default konfigurasi grub agar pada waktu kita reboot, kernel yang dipake adalah kernel xen.
Pastikan untuk mengisi default=0 (penggunaan kernel virtualization) di dalam file grub.conf

# vim /boot/grub/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-164.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-164.1.gls.el5
module /vmlinuz-2.6.18-164.1.gls.el5xen ro root=/dev/vol0/root rhgb quiet
module /initrd-2.6.18-164.1.gls.el5xen.img
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.18-164.el5.img


Pastikan nilai dari uname -r adalah 2.6.18-164.1.el5xen
# uname -r

Setelah langkah di atas berhasil saatnya untuk mencoba menginstall OS virtual, di sini kita menggunakan virt-install, biasakan melakukan pengetikan disertai dengan tab, sehingga akan muncul command-command yang lain seperti ketik virt- [klik tab] akan muncul
virt-clone virt-convert virt-image virt-install virt-manager virt-viewer virt-xml-validate
dsb.


Buat partisi LVM
fdisk /dev/sda

The number of cylinders for this disk is set to 9729.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (2374-9729, default 2374):
Using default value 2374
Last cylinder or +size or +sizeM or +sizeK (2374-9729, default 9729): +10000M

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2308 18434587+ 8e Linux LVM
/dev/sda3 2309 2373 522112+ 82 Linux swap / Solaris
/dev/sda4 2374 3590 9775552+ 83 Linux

Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2308 18434587+ 8e Linux LVM
/dev/sda3 2309 2373 522112+ 82 Linux swap / Solaris
/dev/sda4 2374 3590 9775552+ 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@station20 /]# partprobe
[root@station20 /]# mkfs.ext3 -L benihime /dev/sda4
mke2fs 1.39 (29-May-2006)
Filesystem label=benihime
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1224000 inodes, 2443888 blocks
122194 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2503999488
75 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

# mkdir -p /virt-benihime
# mount -o rw LABEL=benihime /virt-benihime/

Pastikan data yang kita buat untuk benar (size nya 10GB).
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vol0-root
7.8G 2.6G 4.9G 35% /
/dev/mapper/vol0-home
465M 11M 431M 3% /home
/dev/sda1 99M 28M 67M 30% /boot
tmpfs 871M 0 871M 0% /dev/shm
none 871M 48K 871M 1% /var/lib/xenstored
/dev/sda4 9.2G 150M 8.6G 2% /virt-benihime

agar filesystem ini bisa digunakan kita umount terlebih dahulu
# umount /virt-benihime

# virt-install --prompt
What is the name of your virtual machine? benihime-virt
How much RAM should be allocated (in megabytes)? 256
What would you like to use as the disk (file path)? /dev/sda4
What is the install URL? Http://192.168.0.254/pub

Starting install...
Retrieving file vmlinuz... | 2.1 MB 00:00
Retrieving file initrd.img... | 6.6 MB 00:00
Creating domain... | 0 B 00:00
Connected to domain benihime-virt
.................................................... dihilangkan

+---------+ Choose a Language +---------+
| |
| What language would you like to use |
| during the installation process? |


+----+
| OK |
+----+



/ between elements | selects | next screen

Enable IPv4 support |
| (*) Dynamic IP configuration (DHCP) |
| ( ) Manual configuration

pilih Enabled Ipv4


Selebihnya instalasi seperti biasa aja ....... :D, harap untuk install minimalis saja, soalnya ini menggunakan memory 256, install aplikasi seperti Administrator Tools, yang lainya di uncentang aja, terutama X Window ....... :ngacir:

setelah instalasi selesai, posisi masih berada di server Virtual, untuk keluar dari server virtual, dengan menekan [Ctrl] + [shift] + ] (kurung siku kanan).

# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 1733 2 r----- 157.0
benihime-virt 4 255 1 -b---- 30.3

informasi lengkapnya dapat dilihat dengan menggunakan
# xm --help