How to generate a KVM VM witout the installation step?

Kernels & Hardware, configuring network, installing services

How to generate a KVM VM witout the installation step?

Postby fender0107401 » 2019-08-21 12:04

I know I can generate an KVM VM with the virsh-install command, but virsh-install always runs the installation program.

I hope there is a way to generate an KVM VM (set memory size, cpu core number, network and disk image) without running the installation program.

Is that possible?
User avatar
fender0107401
 
Posts: 45
Joined: 2014-05-10 11:42

Re: How to generate a KVM VM witout the installation step?

Postby CwF » 2019-08-22 14:20

What's the question? Does installation refer to the guest OS? If you create the machine with a previous working image as it's storage, it fires up that image. No storage, just a post screen and no OS message. Live iso, boots it...etc.
CwF
 
Posts: 442
Joined: 2018-06-20 15:16

Re: How to generate a KVM VM witout the installation step?

Postby fender0107401 » 2019-08-23 08:12

CwF wrote:What's the question? Does installation refer to the guest OS? If you create the machine with a previous working image as it's storage, it fires up that image. No storage, just a post screen and no OS message. Live iso, boots it...etc.


Yes, the installation refers the guest OS installation.

In fact I am looking an way to write a Perl script to generate many VMs, so I hope I can generate an VM and without starting it (the generation command can immediately run and return).
User avatar
fender0107401
 
Posts: 45
Joined: 2014-05-10 11:42

Re: How to generate a KVM VM witout the installation step?

Postby pcalvert » 2019-08-23 12:41

I never use the virsh-install command. It's not necessary. In fact, that command is not even available on my system.

Here are some examples from my notes:
Code: Select all
# Install Windows XP
$ cd /media/sdc1/VMs
$ qemu-img create Windows-XP-tests.img 5G
$ qemu -localtime -net none -cdrom /media/sdc1/Temp/WinXPpro.iso -m 512 -boot d Windows-XP-tests.img
[I think I wasn't using KVM because I thought the installation might go more smoothly without it (not sure why).]

# Launch the Windows XP SP3 testing VM with networking turned *off*:
$ cd /media/sdc1/VMs
$ kvm -localtime -net none -m 512 -hda Windows-XP-SP3-tests.img -hdb FAT32-1GB.img


Hopefully those examples are helpful. I haven't used QEMU or KVM for several years, so the above info may be a little out of date. Instead of using the qemu or kvm commands, I believe that the proper way to do it nowadays is use variations of the qemu-system command.

Some examples:

qemu-system-i386
qemu-system-x86_64
qemu-system-arm
qemu-system-ppc
qemu-system-ppc64

qemu-system-x86_64 -enable-kvm
[With KVM enabled.]

I hope that's helpful.

Phil
“Property is the fruit of labor; property is desirable; it is a positive good
in the world. That some should be rich shows that others may become
rich, and hence is just encouragement to industry and enterprise.”
— Abraham Lincoln
pcalvert
 
Posts: 1845
Joined: 2006-04-21 11:19
Location: Sol Sector

Re: How to generate a KVM VM witout the installation step?

Postby Head_on_a_Stick » 2019-08-25 15:38

Download a disk image:

https://cdimage.debian.org/cdimage/cloud/buster/daily/

^ Pick today's date then select the generic amd64 qcow2 image.
User avatar
Head_on_a_Stick
 
Posts: 10377
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to System configuration

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable