2014-04-05 58 views
2

我想virt-install命令Xen的使用命令行

我使用Kickstart使用Xen的創建(CentOS的)虛擬機,並把它放在http://192.168.1.8/centos/kickstart.cfg
並把Centos的6.5 http://192.168.1.8/centos/os/ enter image description here

創建新的虛擬機

使用

[[email protected] ~]# dd if=/dev/zero of=/var/lib/xen/images/vserver.img bs=1M count=4000

[[email protected] ~]# virt-install -p -n vserver -r 512 -f /var/lib/xen/images/vserver.img -l http://192.168.1.8/centos/os -x ks=http://192.168.1.8/centos/kickstart.cfg -w bridge:xenbr0 --vcpus=1

結果

Starting install... ERROR Could not find an installable distribution at 'http://192.168.1.8/centos/os' The location must be the root directory of an install tree. Domain installation does not appear to have been successful. If it was, you can restart your domain by running: virsh --connect xen:/// start vserver otherwise, please restart your installation.

+0

此問題顯然屬於SuperUser而不是SO。但是,再次,我已經在這裏,所以不妨幫忙:有沒有理由不使用virsh的網絡安裝方法? –

+0

我從超級用戶刪除它,因爲沒有人回答我,所以我在這裏問它 – Steve

+0

我不明白,你能解釋更多嗎? – Steve

回答

2

它需要的.treeinfo文件,

vi /var/www/html/centos/os/.treeinfo 

並添加此行:

[general] 
family = CentOS 
timestamp = 1341518023.56 
variant = 
totaldiscs = 1 
version = 6.5 
discnum = 1 
packagedir = 
arch = i386 

[images-i386] 

initrd = images/pxeboot/initrd.img 

[images-xen] 

initrd = isolinux/initrd.img 
kernel = isolinux/vmlinuz 

[stage2] 
mainimage = images/install.img 

不直接從複製瀏覽器,通過鍵盤寫入或者首先將其複製到文本文件中爲了刪除任何特殊字符。

終於給Apache的所有權文件:

chown -R apache:apache /var/www/html/* 

在的virt-install命令添加CentOS的(URL)作爲字符串 和使用--bridge=xenbr0代替bridge:xenbr0

[[email protected] ~]# virt-install -p -n vserver -r 512 -f /var/lib/xen/images/vserver.img -l "http://192.168.1.8/centos/os" -x -w --bridge=xenbr0 --vcpus=1 

PS的:改變如果您正在使用64位版本的x86_64,則使用arch字段