Version 13 (modified by rock, 16 years ago) (diff) |
---|
單機
0.相關套件安裝
sudo aptitude install build-essential libncurses5-dev kernel-package iproute bridge-utils python-twisted gcc binutils \ make zlib1g-dev python-dev transfig bzip2 screen ssh debootstrap libncurses5-dev x-dev libsdl1.2-dev bin86 bcc \ python-pam patch latex-make qemu qemu-launcher qemuctl graphviz graphviz-dev lvm2 libvncserver-dev libjpeg62-dev libjpeg62 \ gettext python-xml gawk tetex-extra tetex-base openssl libssl-dev mercurial libc6-dev-i386 libcurl4-openssl-dev \ bzip2 debhelper dpatch libsnmp-dev module-assistant quilt libxml2 python-xml libconfig-inifiles-perl libtext-template-perl
1.安裝 Xen-patched Kernel
- 下載 Xen-patched Kernel
$ sudo dpkg -i linux-xen0-2.6.22.9-rock_2.6.22-16.61_amd64.deb $ sudo mv /boot/xen0-linux-2.6.22.9-rock /boot/vmlinuz-2.6.22.9-rock $ sudo mkinitramfs -o /boot/initrd.img-2.6.22.9-rock 2.6.22.9-rock
2.安裝 Xen Image & tools
- 下載 Xen Source
$ cd /usr/src $ sudo wget http://bits.xensource.com/oss-xen/release/3.3.1/xen-3.3.1.tar.gz $ sudo tar zxvf xen-3.3.1.tar.gz $ cd xen-3.3.1 $ sudo make -j 4 xen $ sudo make -j 4 tools $ sudo make install-xen $ sudo make install-tools
- 編輯 Grub Menu
$ sudo vim /boot/grub/menu.lst title Xen 3.3.1 , kernel 2.6.22.9-rock root (hd0,0) kernel /boot/xen-3.3.1.gz module /boot/vmlinuz-2.6.22.9-rock root=/dev/sda1 ro nosplash module /boot/initrd.img-2.6.22.9-rock
- 重新開機,選擇 Xen patch 過的核心來開機
$ sudo rcconf (將 gdm 關掉) $ sync ; sudo reboot
3.配置 Xen 環境
$ sudo vim /etc/xen/xend-config.sxp (xend-relocation-server yes) (xend-relocation-port 8002) (xend-relocation-hosts-allow '') (network-script 'network-bridge netdev=eth0') (vif-script vif-bridge) (vnc-listen '0.0.0.0')
4.啟動 Xen
$ sudo xend start $ sudo xm list $ sudo xentop $ sudo xm help
5. 製作 VM Image
5.1 自行使用工具製作
- 安裝 xen-tools
$ cd $ wget http://www.xen-tools.org/software/xen-tools/xen-tools-4.1.tar.gz $ tar zxvf xen-tools-4.1.tar.gz $ cd xen-tools-4.1 $ sudo make install $ sudo vim /etc/xen-tools/xen-tools.conf dir = /home gateway = X.X.X.X netmask = X.X.X.X broadcast = X.X.X.X
- 產生 VM Image
$ sudo xen-create-iage --hostname xen01 --ip X.X.X.X
- 啟動 VM
$ cd /etc/xen $ sudo xm create -c xen01
5.2 使用其他團隊已做好的 Image
- 可從以下網站,下載 Image (這些網站將其稱為 virtual appliance),最底下兩個是要付費的
- 練習
$ wget http://virtualappliances.net/download/archive/VirtualAppliancesLAMP-xen-1.0.113.tar.bz2 $ tar jxvf VirtualAppliancesLAMP-xen-1.0.113.tar.bz2 $ cd VirtualAppliancesLAMP $ vim VirtualAppliancesLAMP.cfg $ sudo xm create -c VirtualAppliancesLAMP.cfg
6. 啟動 VM Cluster
此範例是安裝已做好的 Cluster image,1台 Master 和 3台 Slave,裡面已安裝了叢集工具 (C3 command suite,Torque/Maui? queue management 和 MPICH 等)來運行簡單的平行運算。
$ cd /home/virc $ sudo tar zxvf zxvf virtualcluster-1.0.tar.gz $ sudo ./prepare-cluster.sh // 修改參數 (再依續修改 slave1.cfg slave2.cfg slave3.cfg slave4.cfg) $ cd config_files $ vim master.cfg kernel = '/boot/vmlinuz-2.6.22.9-rock' ramdisk = '/boot/initrd.img-2.6.22.9-rock' sudo ./start-cluster.sh sudo xm list