virt-installを使用したコマンドラインからのVM​​のインストール

virt-installを使用したコマンドラインからのVM​​のインストール

婦人声明:

今、私はそれを使ってvirt-manager仮想マシンを作成して管理するのに本当に大きな助けになりました。ホストシステムにグラフィック表示がない場合は、リモートで使用できます(通常はワークステーションである3番目のシステムで)。

インストールチュートリアルでは、vnc「推奨」プロセスは、ホスト、ゲスト、またはその両方にXが必要だと思うようにすることを発見しました。絶対にしないでください。私のせい。同じ状況が発生した場合は、コマンドラインから仮想マシンをインストールする前にもう一度考えてみてください。


Debian Hostを使用してDebian仮想マシンをインストールしようとしていますが、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イメージをローカルで利用できるときに行うのは少し恥ずかしくありませんか?

  • トレーサビリティの喪失:まったく同じソースがないと複製できません。

  • サーバー/ミラー帯域幅を複数回使用します。

  • インターネット接続が必要です。

  • ゆっくり。

ベストアンサー1

この方法は私にとって効果的です。

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'

おすすめ記事