使用virt-install从命令行安装VM


16

免责声明:

现在virt-manager,我用于创建和管理我的VM,它确实可以节省生命。如果主机没有图形显示,则可以远程(从第三台计算机,通常是您的工作站)使用它。

vnc我发现安装教程中出现的内容使我认为“推荐”过程需要X主机,来宾或两者同时使用。绝对不。我的错。如果您处于相同的情况,请在尝试从命令行安装VM之前三思。


我正在尝试使用Debian主机安装Debian VM virt-install,但我不知道如何将其传递给.iso映像。

virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --location=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args='console=tty0 console=ttyS0,115200n8 serial'

Starting install...
Retrieving file info...                                                                                                                                         |  160 B     00:00 ... 
ERROR    Could not find an installable distribution at '/home/jerome/debian-8.0.0-amd64-netinst.iso'
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 qemu:///system start prod
otherwise, please restart your installation.
root@versailles:/etc# 

我所看到的解决方案似乎很扭曲,例如使用apache在本地为.iso图像提供服务,就好像它是来自遥远的地方一样。

我简直不敢这么复杂。是吗?

man virt-install 说:

If you want to use those options with CDROM media, you have a few options:

         * Run virt-install as root and do --location ISO

         * Mount the ISO at a local directory, and do --location DIRECTORY

         * Mount the ISO at a local directory, export that directory over local http, and do --location http://localhost/DIRECTORY

这不是我在做什么吗?

有人说他将.iso移到了/ cdrom上,并且可以正常工作,但是我不完全了解他的所作所为,因此无法复制。

我不能在这个问题中--cdrom代替使用,因为只有--location在使用时才有效。--extra-args--location

virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --cdrom=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args='console=tty0 console=ttyS0,115200n8 serial'
ERROR    --extra-args only work if specified with --location. See the man page for examples of using --location with CDROM media

编辑:

登录 --debug

virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --location=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args='console=tty0 console=ttyS0,115200n8 serial' --debug
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:187) Launched with command line: /usr/share/virt-manager/virt-install --connect qemu:///system --virt-type kvm --name prod --ram 6144 --disk /srv/vm/prod.qcow,format=qcow2,size=10 --location=/home/jerome/debian-8.0.0-amd64-netinst.iso --network bridge=br0 --os-type linux --os-variant debianwheezy --extra-args=console=tty0 console=ttyS0,115200n8 serial --debug
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:195) Requesting libvirt URI qemu:///system
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:199) Received libvirt URI qemu:///system
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:193) Requesting virt method 'default', hv type 'kvm'.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:432) Received virt method 'kvm'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:433) Hypervisor name is 'hvm'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:476) DISPLAY is not set: defaulting to nographics.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (guest:208) Setting Guest.os_variant to 'debianwheezy'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (diskbackend:171) Path '/srv/vm' is target for pool 'srv-kvm'. Creating volume 'prod.qcow'.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (connection:228) Fetching volume XML failed: Storage volume not found: no storage vol with matching path '/media/cdrom0/debian-8.0.0-amd64-netinst.iso'
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (virt-install:551) Guest.has_install_phase: True

Starting install...
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (distroinstaller:417) Using scratchdir=/var/lib/libvirt/boot
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:204) Preparing mount at /var/lib/libvirt/boot/virtinstmnt.srz86f
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:214) mount cmd: ['/bin/mount', '-o', 'ro,loop', '/home/jerome/debian-8.0.0-amd64-netinst.iso', '/var/lib/libvirt/boot/virtinstmnt.srz86f']
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:302) Finding distro store for location=/home/jerome/debian-8.0.0-amd64-netinst.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/.treeinfo
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:325) Prioritizing distro store=<class 'virtinst.urlfetcher.DebianDistro'>
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/current/images/MANIFEST
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/daily/MANIFEST
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/Fedora
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:99) Fetching URI: /var/lib/libvirt/boot/virtinstmnt.srz86f/.disk/info
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:110) Saved file to /var/lib/libvirt/boot/virtinst-info.lZMVqL
Retrieving file info...                                                                                                                                                                                                  |  160 B     00:00 ... 
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:1016) Regex didn't match, not a ALT Linux distro
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/current/images/MANIFEST
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/install/netboot/version.info
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/SL
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/directory.yast
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/CentOS
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/VERSION
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/Server
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/Client
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/RedHat
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/images/pxeboot/vmlinuz
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/images/boot.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/boot/boot.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/current/images/netboot/mini.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:183) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.srz86f/install/images/boot.iso
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (urlfetcher:225) Cleaning up mount at /var/lib/libvirt/boot/virtinstmnt.srz86f
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:234)   File "/usr/share/virt-manager/virt-install", line 876, in <module>
    sys.exit(main())
  File "/usr/share/virt-manager/virt-install", line 870, in main
    start_install(guest, continue_inst, options)
  File "/usr/share/virt-manager/virt-install", line 588, in start_install
    fail(e, do_exit=False)
  File "/usr/share/virt-manager/virtinst/cli.py", line 234, in fail
    logging.debug("".join(traceback.format_stack()))

[mer., 03 juin 2015 17:46:12 virt-install 12991] ERROR (cli:235) Could not find an installable distribution at '/home/jerome/debian-8.0.0-amd64-netinst.iso'
The location must be the root directory of an install tree.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:237) 
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-install", line 560, in start_install
    dom = guest.start_install(meter=meter, noboot=options.noreboot)
  File "/usr/share/virt-manager/virtinst/guest.py", line 384, in start_install
    self._prepare_install(meter, dry)
  File "/usr/share/virt-manager/virtinst/guest.py", line 277, in _prepare_install
    util.make_scratchdir(self.conn, self.type))
  File "/usr/share/virt-manager/virtinst/installer.py", line 201, in prepare
    self._prepare(guest, meter, scratchdir)
  File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 444, in _prepare
    self._prepare_kernel_url(guest, fetcher)
  File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 347, in _prepare_kernel_url
    store = urlfetcher.getDistroStore(guest, fetcher)
  File "/usr/share/virt-manager/virtinst/urlfetcher.py", line 346, in getDistroStore
    fetcher.location))
ValueError: Could not find an installable distribution at '/home/jerome/debian-8.0.0-amd64-netinst.iso'
The location must be the root directory of an install tree.
[mer., 03 juin 2015 17:46:12 virt-install 12991] DEBUG (cli:248) Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start prod
otherwise, please restart your installation.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start prod
otherwise, please restart your installation.

它可以使用,--location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/但是当.iso映像在本地可用时,这样做是否有点可耻?

  • 可追溯性的丧失:您以后无法再复制,请确保获得的源完全相同。

  • 服务器/镜像的带宽使用倍增。

  • 需要互联网访问。

  • 慢点。


没错,但是您可以通过使用apt-cacher-ng来构建本地程序包缓存服务器,或者使用apt-mirrorftpsync来构建完整的镜像来减轻某些弊端。实际上,CD / DVD / BD发行版只是Debian优秀软件包集合中的一小部分,它有害地破坏了它的利益,并激怒了我们。因此,许多人倾向于维护其本地镜像并从安装开始就享受其完整性。
yaegashi 2015年

此问题已在virt-manager 1.4.3(commit)中修复。
汤姆,

Answers:


6

virt-install尝试从ISO映像中提取内核和initrd文件。有了它,--debug您可以看到它的全部活动,包括循环安装,搜索那些文件等。

Starting install...
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (Installer:182) scratchdir=/var/lib/libvirt/boot
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:184) Preparing mount at /var/lib/libvirt/boot/virtinstmnt.dwcpql
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (OSDistro:65) Attempting to detect distro:
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/.treeinfo
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/Fedora
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/Server
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/Client
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/RedHat
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/CentOS
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/SL
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/directory.yast
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/current/images/MANIFEST
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/daily/MANIFEST
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/current/images/MANIFEST
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/install/netboot/version.info
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/initrd.gz
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (OSDistro:990) Doesn't look like an Ubuntu Distro.
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/VERSION
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/VERSION
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/boot/platform/i86xpv/kernel/unix
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/platform/i86xpv/kernel/unix
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/STARTUP/XNLOADER.SYS
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/images/pxeboot/vmlinuz
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/images/boot.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/boot/boot.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/current/images/netboot/mini.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:169) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.dwcpql/install/images/boot.iso
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] DEBUG (ImageFetcher:205) Cleaning up mount at /var/lib/libvirt/boot/virtinstmnt.dwcpql
[Wed, 03 Jun 2015 07:56:40 virt-install 29692] ERROR (cli:445) Could not find an installable distribution at '/home/yaegashi/debian-8.0.0-amd64-netinst.iso'

我想virt-install不支持Debian netinst ISO映像--location(但是不知道Ubuntu是否支持?)。

要使用引导内核--extra-argsvirt-install需要具有那些内核和相应的initrd文件。 --cdrom只需将ISO附加到来宾的CD驱动器上,就无法使用--extra-args

如果要使用--extra-args,我建议您通过指定最近镜像的Debian安装程序URL来使用“ netboot”内核/ initrd文件,如 --location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/手册中所述。


谢谢。似乎没有简单的方法来接受您的答案,但我认为此方法存在问题(问题已相应更新)。
杰罗姆

这当然可以工作,但是我认为它不能回答如何从本地iso安装的问题,如果您无法访问Internet,则可能需要这样做。
里克·查塔姆

请注意,这不是指向ISO的链接,而是指向...包含ISO的目录结构的链接。花了我一些努力来解决这个问题。为什么这在KVM-Debian上的工作方式与KVM-CentOS(我刚刚从其迁移过来的)不同?我不知道,但这是可行的(仍然在2019年)。
Chaim Eliyah '19

8

这种方法对我有用:

virt-install --name=centos \
--memory=8196 --vcpus=2 \
--location=/var/lib/libvirt/images/CentOS-7-x86_64-Minimal-1511.iso \
--disk /var/lib/libvirt/images/centos7.qcow2,device=disk,bus=virtio,size=8 \
--network bridge:br0 \
--os-type=linux  \
--nographics \
--extra-args='console=tty0 console=ttyS0,115200n8 serial'

2
个人最喜欢的答案。很简单的演示,让我理解。谢谢!
bitofagoob

这对Centos很好,但是对Debian或Ubuntu ISO文件不起作用。您将得到与原始问题中所述相同的问题。解决方案是为安装程序的位置指定一个URL --location ftp.us.debian.org/debian/dists/stable/main/installer-amd64
GeraldScott

1

区别在于所使用的iso文件

它与使用方式无关virt-install--location用于http URL与--location用于本地iso文件的路径)。

下面是使用时的作品命令Debian的在线储存库--location(包括获得输出来完成安装,直到第一次启动(当时另外两个必要的步骤,最终进入新的虚拟机,但这是另一回事):

virt-install --virt-type kvm --name test8 --memory 2048 --disk path=/var/lib/libvirt/images/test8-1.qcow2,size=5 --disk path=/var/lib/libvirt/images/test8-2.qcow2,size=2 --location http://ftp.at.debian.org/debian/dists/stable/main/installer-amd64/ --graphics none --extra-args='console tty0 console=ttyS0,115200n8 serial'

您可以使用完全相同的命令,但是将上述Centos ISO文件用作--location,并且效果也很好(除了与串行控制台的连接乍一看似乎不起作用,但原则上安装是使用--location开始的)和ISO文件):

virt-install --virt-type kvm --name test8 --memory 2048 --disk path=/var/lib/libvirt/images/test8-1.qcow2,size=5 --disk path=/var/lib/libvirt/images/test8-2.qcow2,size=2 --location /softwarestorage/CentOS-7-x86_64-Minimal-1511.iso --graphics none --extra-args='console tty0 console=ttyS0,115200n8 serial'

输出为:

Starting install...
Retrieving file .treeinfo...                                                                                                                                                                | 2.2 kB     00:00 ... 
Retrieving file vmlinuz...                                                                                                                                                                  | 9.8 MB     00:00 ... 
Retrieving file initrd.img...                                                                                                                                                               |  73 MB     00:00 ... 
Creating domain...                                                                                                                                                                          |    0 B     00:00     
Connected to domain test8
Escape character is ^]

但是,如果您将Debian ISO文件用于--location,则会出现错误:

virt-install --virt-type kvm --name test8 --memory 2048 --disk path=/var/lib/libvirt/images/test8-1.qcow2,size=5 --disk path=/var/lib/libvirt/images/test8-2.qcow2,size=2 --location /softwarestorage/debian-8.5.0-amd64-CD-1.iso --graphics none --extra-args='console tty0 console=ttyS0,115200n8 serial'

Starting install...
Retrieving file info...                                                                                                                                                                     |  150 B     00:00 ... 
ERROR    Could not find an installable distribution at '/softwarestorage/debian-8.5.0-amd64-CD-1.iso'
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 qemu:///system start test8
otherwise, please restart your installation.

恕我直言,这证明Debian ISO缺少某些东西/“不正确”(目前不确定我是从哪里得到的,但也许有人可以下载一个新的并重复测试...)


我认为您是...非常错误。在第一个示例中,您要指定一个FTP位置,在第二个示例中,您要指定一个本地ISO文件。这两种方法有所不同,因为使用FTP和HTTP URL,virt-install可以“遍历”寻找initrd.img和的目录结构kernel.img。对于本地ISO,virst-install必须首先mount使ISO遍历目录结构,并且当然mount需要root访问权限才能挂载任意(非fstab)位置。
Dejay Clayton

@DejayClayton:他是对的。我花了整整一天的时间尝试在Centos 6主机上使用完全相同的安装和导出过程安装Ubuntu 16.04、18.04和Centos 7.1,并--location使用全部3。Centos-6 virt-install无法识别Ubuntu目录结构,并--debug告诉您。Centos-7的顶层包含一个.treeinfo,它是所virt-install寻找的东西之一,因此它尝试启动它。但是无论如何以后都会失败。我对这个软件真是一堆****感到惊讶。
EML

1

以下内容适用于我从Ubuntu 16.04主机系统安装Debian 10:

cd /usr/share/virt-manager/virtinst/
patch <<.
--- urlfetcher.py.orig 2019-07-25 13:54:37.496567791 +1200
+++ urlfetcher.py      2019-07-25 13:54:43.180373257 +1200
@@ -663,6 +663,8 @@
                 ]
     _hvm_paths = [("pxeboot/vmlinuz",
                     "images/pxeboot/initrd.img"),       # Fedora
+                  ("install.amd/vmlinuz",
+                    "install.amd/initrd.gz"),   # Debian
                 ]
     _iso_paths = ["images/boot.iso",                   # RH/Fedora
                    "boot/boot.iso",                     # Suse
.

virt-install ... --location=/srv/software/Debian/debian-10.0.0-amd64-netinst.iso --extra-args='console=tty0 console=ttyS0,115200n8'

0

这很丑陋,特别是如果您想使用kickstart文件,但是我为使该过程继续进行了以下操作:

root@kvm:~# virt-install -n rhce2 -r 2048 --vcpus=1 --os-variant=rhel6 --accelerate -v --disk path=/var/lib/libvirt/images/RHCE2.img,size=100 -l /root/centos6.7.iso -x "ks=./ks1.cfg" --nographics

我所做的事情和您所做的事情之间的基本区别是,我使用了--location标记(-l简称)来指向我的iso。


这是非常错误的。不同之处在于,他是从debian netinstall iso文件安装的,而您正在安装RHCE2
carandraug

0

最近遇到了这个问题。只需将远程安装程序与--location一起使用即可。我必须强调,根据您的virsh版本,手册页中的远程安装程序链接可能已过时。

我只是按照此示例操作,一切运行顺利:https : //www.packet.com/developers/guides/kvm-and-libvirt/

就我而言,我在http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/中将'xenial'更改为'bionic',安装完成了。从现在开始每次都要使用此方法。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.