linux - xen 使用命令行创建新虚拟机

标签 linux centos virtual-machine virtualization xen

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

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

使用

[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 桥:xenbr0 --vcpus=1

结果

开始安装... 错误无法在“http://192.168.1.8/centos/os”找到可安装的发行版 该位置必须是安装树的根目录。 域安装似乎没有成功。 如果是,您可以通过运行以下命令重新启动您的域: virsh --connect xen:///启动虚拟服务器 否则,请重新启动安装。

最佳答案

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

关于linux - xen 使用命令行创建新虚拟机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22879230/

相关文章:

Azure虚拟机: Why do I only have an option for Windows Server 2016 Data Center

linux - PYCURL 错误 6 - "Couldn' t 解析主机 'mirrorlist.centos.org'“

python - 导入 pymorphy2 时出现异常

PHP system() 给出的结果与终端不同,缺少字体

linux - PostgreSQL : download schema at the same time while showing using\d+ <table_name> command?

python-2.7 - CentOs 服务器上的 slack 文件上传失败

Git + libsecret 抛出 "Cannot autolaunch D-Bus without X11 $DISPLAY"

linux - 'less' 'which' 的输出指定的文件

perl - Cron 没有在 PERL 中执行我的 system() 语句

azure - Azure 是否支持客户端操作系统(即 Windows 7)?