【问题标题】:xen create new virtual machine using command linexen 使用命令行创建新的虚拟机
【发布时间】:2014-04-05 09:46:34
【问题描述】:

我想通过virt-install命令使用xen创建(CentOS)虚拟机

我正在使用 kickstart 并将其放入 http://192.168.1.8/centos/kickstart.cfg
并将 Centos 6.5 放入 http://192.168.1.8/centos/os/

使用

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

[root@CentOS ~]# 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.

【问题讨论】:

  • 这个问题显然属于 SuperUser 而不是 SO。不过话说回来,我已经来了,还不如帮忙:你不使用virsh的网络安装方法有什么原因吗?
  • 我从超级用户中删除它,因为没有人回答我,所以我在这里问它
  • 没看懂,能多解释一下吗?
  • 如果一天左右内没有人在 SuperUser 中回答您的问题,您可能会将其视为问题本身就是问题的提示。例如,也许您可​​以重写您的问题以包含更多信息/省略不必要的重复等等。大多数人真的很喜欢提供帮助,但通过写出好问题来帮助他们帮助你是交易的一部分。
  • man virt-install,尤其是关于--location的部分。这样您就可以使用网络 URI 作为安装介质,无需复制本地硬盘中的内容并使用 HTTP 提供服务。

标签: linux centos virtual-machine virtualization xen


【解决方案1】:

需要 .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

[root@CentOS ~]# 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

P.S:如果您使用 64 位版本,请将 arch 字段更改为 x86_64

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-06
    相关资源
    最近更新 更多