ä¼ç¤¾ã®ãã¼ã ã§ã®éçº(Webã¢ããª)ä½æ¥ã¯å ¨ã¦Linuxä¸ã§è¡ã£ã¦ãã¾ããã§ããã®Linuxã¯ãåºç¤ãXenã«ããä»®æ³OSä¸ã§è¡ã£ã¦ãã¾ãã
1人ããã1ä»®æ³OSãå²ãå½ã¦ã¦ãããããéçºã¡ã³ãã¯å¥½ããªããã«èªå好ã¿ã®ç°å¢ãä½ããã¨ãåºæ¥ã¾ãã
ã§ãã¡ã³ãã®èª°ãã使ããããªããã«ã¦ã§ã¢ãã©ã¤ãã©ãªãªã©ã¯ãå ¨å¡ãå ±éã®ãã£ã¹ã¯é åããã¦ã³ããããã¡ãã使ã£ã¦ãããããã«ãã¦ãã¾ãããããã¦ãããã¨ã§ãããã«ã¦ã§ã¢ãã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³ã¢ãããããã¨ãã¯ãä¸ç®æã ããã¼ã¸ã§ã³ã¢ãããããã°ãå ¨å¡ããã®æ©æµãåãããã¨ãã§ãããªããªã便å©ã
ã¡ãªã¿ãXenã¨ã¯ï¼ã«ã¤ãã¦ã¯ä»¥ä¸ã®ãªã³ã¯ãããã¾ã¨ã¾ã£ã¦ããã¨æãã¾ãã
ãã®ç°å¢ã¯ãããä»å¹´ã®1æãã稼åããã¦ãã¦ãä»ã®ã¨ããæã£ã¦ããããã¯é¥ãã«å®å®ãã¦ç¨¼åãã¦ããã¦ãã¾ãã
ãã®æã®æ§ç¯ä½æ¥ãã°ã社å
ã§å
¬éãã¦ããã®ã§ãããå¤ãã確èªããããªããã¨ãããããã£ã¡ã«ãæ¸ãã¦ãããã¨ã
ç°å¢
ãããªãã·ã³ãä¸å°ä½¿ãã¾ããã
CPU | Pentium4 2.8GHz |
---|---|
Memory | 2GB |
Disk | 80GB x 2 (RAID1) |
OS | Debian GNU/Linux Etch (testing) [kernel 2.6.18-3] |
ãã®ã¹ããã¯ã®ãã·ã³ä¸ã§ããã¡ã¤ã³0ããã¡ã¤ã³Uã¨ãã«åããã¦ã¿ããã¨ã«ãã¾ãã
ã¡ãªã¿ã«ããã®ç©çãã¼ãã¦ã§ã¢ã®ä¸ã§ãä»®æ³ãã·ã³(ãã¡ã¤ã³U)ã4å°ç¨¼åããã¦ãã¾ãã快調ã§ããã
å½æã¯ãDebianã®etchããã¾ã testingãã£ã¹ããªãã¥ã¼ã·ã§ã³ã ã£ãã®ã§ããã
Debianã§å¿ è¦ã¨ãªãããã±ã¼ã¸ã®ç¢ºèª
Xenãåããä¸ã§å¿ è¦ã¨ãªãããã±ã¼ã¸ãç¨æããå¿ è¦ãããã¾ãã
å°ãä¸è¨ã®ããã±ã¼ã¸(debootstrapã¯é¤ã)ã¯Xenã®ã¤ã³ã¹ãã¼ã©ã§ããåå¨ãã¦ãããã©ããããã§ãã¯ãã¦ãããã®ã§ãç¡ãã¨è¨ããã¦ããã¤ã³ã¹ãã¼ã«ãã¦ãOKã ã¨æãã¾ãã
# debootstrapã¯ãã§ãã¯ãã¦ãããªãã®ã§æ³¨æã
# ç¡ãã¦ãåé¡ãªããã©ããã£ãæ¹ããã¡ã¤ã³Uã®æ§ç¯ãå§åçã«æ¥½ã
å¿ è¦ãªããã±ã¼ã¸ããæç¡ã®ç¢ºèªæ¹æ³ããªãã£ãå ´åã®ã¤ã³ã¹ãã¼ã«æ¹æ³ãªã©ãç°¡åã«ã¾ã¨ãã¦ããã¾ãã
å¿ è¦ããã±ã¼ã¸ä¸è¦§
- bridge-utils
- iproute
- hotplug
- python
- zlib1g
- debootstrap
ããã±ã¼ã¸æç¡ã®ç¢ºèªæ¹æ³
$ dpkg -l {ããã±ã¼ã¸å}
ããã±ã¼ã¸ã®ã¤ã³ã¹ãã¼ã«æ¹æ³
$ sudo apt-get install {ããã±ã¼ã¸å}
Xenã¤ã³ã¹ãã¼ã«ãã°
ãã¦ãã§ã¯æ©éXenãã®ãã®ãã¤ã³ã¹ãã¼ã«ãã¦ã¿ããã¨æãã¾ãã
$ mkdir ~/install $ cd ~/install $ wget http://bits.xensource.com/Xen/latest/xen-3.0.2-install-x86_32.tgz $ tar zxvf xen-3.0.2-install-x86_32.tgz $ cd xen-3.0.2-2-install/ $ sudo ./install.sh
ãããªæãã§ã¤ã³ã¹ãã¼ã«å®äºã®æ¨ãåºåãããã¨æãã¾ããããã§ãå¿ è¦ãªããã±ã¼ã¸ã®æç¡ã確èªããã¦ãããã¨ãåããã¨æãã¾ãã
Installing Xen from './install' to '/'... - installing for udev-based system - modifying permissions All done. Checking to see whether prerequisite tools are installed... Xen CHECK-INSTALL 2007å¹´ 1æ 10æ¥ æ°´ææ¥ 17:35:43 JST Checking check_brctl: OK Checking check_hotplug: OK Checking check_iproute: OK Checking check_python: OK Checking check_zlib_lib: OK All done.
ãã¡ã¤ã³0ã®æ§ç¯(è¨å®)
ã§ã¯ããã¡ã¤ã³0(ã¤ã¾ããã¹ãOS)ãè¨å®ãã¦ããããã¨æãã¾ãã
initrdã®ä½æ
é¢åãããã®ã§ãããããã¯rootã«suãã¦ä½æ¥ã
# su - # depmod -a -v 2.6.16-xen # mkinitramfs -o /boot/initrd.img-2.6.16-xen /lib/modules/2.6.16-xen/
GRUBã®è¨å®
æä¸é¨ã«ãããªæãã§è¿½è¨ãã¾ãã
# vi /boot/grub/menu.lst
å 容ã¯ãããªæãã§ã
â» ä»åã®ç©çãã¼ãã¦ã§ã¢ä¸ã§ã¯ã½ããã¦ã§ã¢RAIDãçµãã§ããã®ã§ããã¤ã¹ã/dev/md0ã¨ãªã£ã¦ãã¾ãã注æãã¦ãã ãããéRAIDã§ããã°/dev/hda0(ãã©ã¤ããªIDE)ã¨ã/dev/sda0(SCSI)ã¨ãããªã
title Xen-3.0.2-2 root (hd0,0) kernel /boot/xen-3.0.gz dom0_mem=524288 module /boot/vmlinuz-2.6-xen root=/dev/md0 ro console=tty1 module /boot/initrd.img-2.6.16-xen savedefault boot
ãdom0_memãã«ã¯ãã¡ã¤ã³0ã§å©ç¨ããã¡ã¢ãªå®¹éãæå®ãã¾ãã(åä½ : KB)
xendã®èªåèµ·åãè¨å®
ãã®ãããã¯ãæä¾ã®ä½æ¥ã§ããã
# update-rc.d xend defaults 99
ãã¾ããã£ããããããªæãã§è¡¨ç¤ºãããã¨æãã¾ãã
Adding system startup for /etc/init.d/xend ... /etc/rc0.d/K99xend -> ../init.d/xend /etc/rc1.d/K99xend -> ../init.d/xend /etc/rc6.d/K99xend -> ../init.d/xend /etc/rc2.d/S99xend -> ../init.d/xend /etc/rc3.d/S99xend -> ../init.d/xend /etc/rc4.d/S99xend -> ../init.d/xend /etc/rc5.d/S99xend -> ../init.d/xend
/lib/tlsã®ãã£ã¬ã¯ããªåå¤æ´
ããã¯ãç´æã®æ¨¡æ§ããããªãã¦ãåãã®ã ããWarningãåºããã¨ã¨ããã©ã¼ãã³ã¹ã®ä½ä¸ãçºçãããããã
# mv /lib/tls /lib/tls.disabled
åèµ·åï¼åä½ç¢ºèª
ããã¾ã§ã§ãã¡ã¤ã³0ã®è¨å®ä½æ¥ã¯å®äºãåèµ·åã
# shutdown -r now
åèµ·åå¾ãGRUBã®ã¡ãã¥ã¼ç»é¢ã§ããXen-3.0.2-2ããé¸æã
èµ·åå¾ããã°ã¤ã³ã以ä¸ã®ã³ãã³ããçºè¡ãã¦ã¿ãã
# uname -r 2.6.16-xen # xm list Name ID Mem(MiB) VCPUs State Time(s) Domain-0 0 512 2 r----- 13.2
Xenç¨ã®ã«ã¼ãã«ã§ããã£ã¦ãã¦ã¾ããããã¡ã¤ã³0ã
ãã¾ããããã¨ã確èªããããGRUBã®è¨å®ã§ã¡ãã¥ã¼ç»é¢ã§èªåã§Xenç¨ã«ã¼ãã«ãé¸æãããããã«è¨å®ãã¦ããã¨è¯ãã§ãã
ãã¡ã¤ã³Uãæ§ç¯
ã§ã¯ããã¡ã¤ã³0ãåºæ¥ä¸ãã£ãã¨ããã§ãä»®æ³OSã¤ã¡ã¼ã¸ãä½æãã¦ããã¡ã¤ã³U(ä»®æ³ãã·ã³, ä»®æ³OS)ãåããããã¨æãã¾ãã
ã¤ã¡ã¼ã¸ãã¡ã¤ã«ã®ä½æ
ããã¾ã§ã®ãã¼ã ã®éçºç¶æ³ãã¿ã¦ã1人ããã1.5ã2GBç¨åº¦ã®å©ç¨ç¶æ³ã®ãããªã®ã§ã4GBã»ã©ç¢ºä¿ãã¦ãããã¨ã«ãã¾ãã
# ãã®è¾ºã®ãã©ã¡ã¼ã¿ã¯é©å®å¤æ´ãã¡ãã£ã¦ãã ããã
$ sudo mkdir -p /home/virtual_machines/rx7 $ sudo chown sonic:sonic /home/virtual_machines/rx7 $ dd if=/dev/zero of=/home/virtual_machines/rx7/debian-root.img bs=1024k count=4096
å®è¡ããã¨ããããªæãã§åºåããã¦ããã
4096+0 records in 4096+0 records out 4294967296 bytes (4.3 GB) copied, 93.169 seconds, 46.1 MB/s
4GBã®ã¤ã¡ã¼ã¸ãåºæ¥ä¸ããã¾ããã
åãããã«swapé åã®åãã512MBãããã§ããããªã
$ dd if=/dev/zero of=/home/virtual_machines/rx7/debian- swap.img bs=1024k count=512
åãããã«ããããªæãã§åºåããã¦ããã
512+0 records in 512+0 records out 536870912 bytes (537 MB) copied, 8.91269 seconds, 60.2 MB/s
åºæ¥ä¸ããã
次ã«ãä½ã£ãã¤ã¡ã¼ã¸ãmkfsã§Linuxã®ãã¡ã¤ã«ã·ã¹ãã (ext3)ã«ãã¾ãã
$ /sbin/mkfs.ext3 /home/virtual_machines/rx7/debian-root.img
ã¤ã³ã¿ã©ã¯ãã£ãã«é²ãã¦ããã¾ãã以ä¸ã®ãããªæãã§å ¥åã
mke2fs 1.40-WIP (14-Nov-2006) /home/virtual_machines/rx7/debian-root.img is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 524288 inodes, 1048576 blocks 52428 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1073741824 32 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
swapé åãåããããªæãã§ä½æã
$ /sbin/mkswap /home/virtual_machines/rx7/debian-swap.img
ãããªæãã§ããã£ã¡ã¯ããã«åºæ¥ã¡ããã¾ãã
Setting up swapspace version 1, size = 536866 kB no label, UUID=b611d5e9-e0c1-4b2c-896f-51afddf02f70
æå¾ã®ä»ä¸ãã§ããä½ã£ãã¤ã¡ã¼ã¸(FS)ããã¦ã³ããã¦åãããç¶æ
ã«ãã¾ãã
ãã¦ã³ããã¦ãdebootstrapã§OS稼åã«å¿
è¦ãªãã¡ã¤ã«ãã¤ã³ã¹ãã¼ã«ãã¾ãããã
$ su # mkdir /mnt/debian.img # mount -o loop /home/virtual_machines/rx7/debian- root.img /mnt/debian.img # debootstrap --arch i386 etch /mnt/debian.img http://ftp.jp.debian.org/debian
ããã¨ããã¼ã£ã¨ã¤ã³ã¹ãã¼ã«ãå§ã¾ã£ã¦ããã
ãããçç¥ããã I: Base system installed successfully.
ãããªæãã§ãæå¾ã«ãBase system installed successfullyããåºãã°æåã
ããã¾ã§ã§ãã¤ã¡ã¼ã¸ãã¡ã¤ã«ã®ãã¼ã¹é¨åã®ä½æãå®äºã§ãã
ãã¡ã¤ã³Uã®ã·ã¹ãã è¨å®
ãã¨ããã¡ã¤ã³Uã¨ãã¦åããããã«è¨å®ããªããã°ãããªãã®ã¯ã以ä¸ã®ãã¡ã¤ã«ã¨ãªãã¾ãã
- /etc/fstab
- /etc/hostname
- /etc/hosts
- /etc/network/interfaces
- /etc/apt/sources.list
ã¨ããããã§ãä¸ã¤ãã¤ãã£ãã£ãã¨ãã£ã¦ããã¾ãã
ã¾ãã¯ã/etc/fstabããã
# cd /mnt/debian.img # vi etc/fstab
以ä¸ã®å 容ã§æ¸ãæãã
/dev/sda1 / ext3 defaults 0 1 /dev/sda2 swap swap defaults 0 0 proc /proc proc defaults 0 0
次ã/etc/hostnameã
# vi etc/hostname
以ä¸ã®å 容ã§æ¸ãæãããã®è¾ºã¯ä»»æã®æååã§OKã
rx7-xenU
次ã/etc/hostsã
# vi etc/hosts
以ä¸ã®å 容ã§ä½æããã£ãã®hostnameã¨åããã¦ããã¾ãããã(hostnameã®é¨åã¯æ¸ããªãã¦ãè¯ããã©)
127.0.0.1 localhost rx7-xenU
次ã¯NICã¾ããã
# vi etc/network/interfaces
以ä¸ã®å 容ã§æ¸ãæããâã¯DHCPããIPã¢ãã¬ã¹ããããå ´åããéçã«æ¯ãã¨ãã¯dhcpãããªãã¦staticã¨æ¸ãã¦ãIPã¢ãã¬ã¹ãããããã¯ã¼ã¯ã¢ãã¬ã¹ãããã¼ããã£ã¹ãã¢ãã¬ã¹ãããæ¸ãã¦ããã¾ãããã詳ããã¯Googleå çã«èãã¦ã¿ãã¨ã¨ããããæãã¦ãããã¨æãã¾ãã
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
次ã«aptã¾ããã
# vi etc/apt/sources.list
以ä¸ã®å 容ã§ä½æã
deb http://ftp.jp.debian.org/debian/ etch main contrib non-free deb-src http://ftp.jp.debian.org/debian/ etch main contrib non-free deb http://security.debian.org/ etch/updates main contrib deb-src http://security.debian.org/ etch/updates main contrib
æå¾ã«ããã¡ã¤ã³0ã¨åããã/lib/tlsã使ãããªãããã«ãã¦ãããã¨ã
# mv lib/tls lib/tls.disabled
ããã¦ãä½æ¥ãçµãã£ãã®ã§ãã²ã¹ãOSã®ã¤ã¡ã¼ã¸ãã¢ã³ãã¦ã³ãã
# cd / # umount /mnt/debian.img
ä»ä¸ãã«ãXenã®ã²ã¹ãOSç¨è¨å®ãã¡ã¤ã«ãä½æã
# vi /etc/xen/rx7-debian
以ä¸ã®å 容ã§ä½æãã¾ãã
name="rx7-debian" memory=384 kernel="/boot/vmlinuz-2.6.16-xen" nics=1 ramdisk="/boot/initrd.img-2.6.16-xen" disk=['file:/home/virtual_machines/rx7/debian-root.img,sda1,w','file:/home/virtual_machines/rx7/debian-swap.img,sda2,w'] root="/dev/sda1 ro"
ãã¦ããããããã¡ã¤ã³Uãèµ·åãã¦ã¿ã¾ãã
# xm create -c /etc/xen/rx7-debian
ããã§ããã°ããããã¨ããã¡ã¤ã³Uã®ã³ã³ã½ã¼ã«ãåºã¦ãã¦ããã°ã¤ã³ã§ããããã«ãªãã¨æãã¾ãã
- åºç社/ã¡ã¼ã«ã¼: IDGã¸ã£ãã³
- çºå£²æ¥: 2006/11/01
- ã¡ãã£ã¢: ã ãã¯
- ã¯ãªãã¯: 10å
- ãã®ååãå«ãããã° (4件) ãè¦ã
ãªã¼ãã³ã½ã¼ã¹å¾¹åºæ´»ç¨Xen3.0ã«ããä»®æ³åãµã¼ãã®æ§ç¯
- ä½è : å±±æ¬é ä¹
- åºç社/ã¡ã¼ã«ã¼: ç§åã·ã¹ãã
- çºå£²æ¥: 2006/08/08
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 1人 ã¯ãªãã¯: 26å
- ãã®ååãå«ãããã° (13件) ãè¦ã