2010年8月9日 星期一

Xen 4.0 installation on debian lenny

原來現在科技那麼進步,virtual machine的發展讓一台主機可以更加發揮它的硬體功能,
之前都不知道XEN這個東西,直到冠宏哥叫我去灌,我才去研究一下到底是好在哪裡,
主要可以看看鳥哥的文件利用 Xen 設計虛擬機器,真的是很有趣,不過xen想要灌新版本真的有點麻煩,到處找都只有ubuntu上面的資料,中間也遇到一些困難,以下就是我的紀錄:

安裝基本套件
首先安裝最小化的debian lenny ,然後安裝需要的套件包:

# sudo aptitude install bcc bin86 gawk bridge-utils iproute \
libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif \
texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra \
texlive-fonts-recommended pciutils-dev mercurial build-essential \
make gcc libc6-dev zlib1g-dev python python-dev python-twisted \
libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev \
iasl libbz2-dev e2fslibs-dev git-core uuid-dev

//64bit要加安裝
# sudo aptitude install gcc-multilib

安裝Xen4.0
因為我們要安裝的Xen hypervisor不再套件庫中,所以要自己從source code安裝:

# cd /usr/src
# sudo wget http://bits.xensource.com/oss-xen/release/4.0.0/xen-4.0.0.tar.gz
# sudo tar zxvf xen-4.0.0.tar.gz
# cd xen-4.0.0/
# make xen tools stubdom
# sudo make install-xen install-tools install-stubdom
安裝Kernel
因為Xen4.0 需要利用2.6.32版本的kernel,我們可以從backports套件庫中下載新的kernel套件:

# echo "deb http://www.backports.org/debian lenny-backports main" >> 
/etc/apt/sources.list
# aptitude update
# aptitude install debian-backports-keyring
# aptitude update
# aptitude install linux-image-2.6.32-bpo.5-amd64 
  linux-image-2.6.32-bpo.5-xen-amd64

修改開機要包含module
加入這些module讓xend process 能夠跟hypervisor通訊:

netbk
blkbk
blktap
xenfs
xen-evtchn

Xen4 service setup

# update-rc.d xend defaults 20 21
# update-rc.d xendomains defaults 20 21

重新啟動系統
# sudo reboot

安裝xen-tools
# sudo aptitude install libtext-template-perl debootstrap
# wget http://xen-tools.noone.org/software/xen-tools/xen-tools-4.1.tar.gz
# tar zxvf xen-tools-4.1.tar.gz
# cd xen-tools-4.1
# make install

Troubleshooting
啟動後我的網路就炸掉了,原因是因為太多程式在管理網路,發現/var/log/message裡面的資訊
dhcdbd: Started up.
dhcdbd: message_handler: message handler not found
under /com/redhat/dhcp/peth0 for sub-path peth0.dbus.get.reason

讓我們來關閉他
sudo update-rc.d -f dhcdbd remove

Reference:
http://linux.vbird.org/linux_enterprise/xen.php#xen_hw
http://publications.jbfavre.org/virtualisation/migration_form_xen3_to_xen4_lvm_drbd_debian.en
http://www.cnblogs.com/ddr888/archive/2010/06/01/1746565.html
http://trac.nchc.org.tw/grid/wiki/Xen_Installation/Xen4
http://www.vpsee.com/2010/04/install-xen-on-debian-from-source/
http://wiki.xensource.com/xenwiki/Xen4.0
http://wiki.xensource.com/xenwiki/XenParavirtOps
http://www.gossamer-threads.com/lists/xen/users/169380

Blogger is great!

新增了好多功能阿, 現在變得越來越方便的樣子了!

看來應該要好好的利用這些功能阿!