0

If I have a virtual machine, how can I install on it an operating system skipping the installation steps?

In other words, when I choose an operating system to be installed on the VM, I want to use it immediately without bothering with the installation steps (like choosing the language, username, etc)

Also how can it be a headless VM? Meaning that I don't need the OS with a graphical user interface. I only want to use it via the terminal.

Is there anyway that I can do that?

Note: I am using KVM and libvirt.

Matthew Wetmore
  • 1,631
  • 12
  • 20
NSD
  • 1
  • Yes, though the answer is very much dependent on the OS you are attempting to install. If it's windows you need an answer file or an image of a pre-configured VM. If it's linux you'll need to orchestrate it with puppet or kickstart, or have an image of a pre-configured VM. You will need to be more specific in your request though, as there are many answers people could give you that would be correct but no use to you. – Alex Berry Mar 14 '17 at 15:17
  • I want to make my own Linux configured images. I'm also using xCAT but I'm not sure if it is responsible for making a configured image or not. – NSD Mar 14 '17 at 15:19
  • For `Debian` family OS you can use a [preseed](https://www.debian.org/releases/jessie/example-preseed.txt) file. You can find the details how it works in `Debian` [wiki](https://wiki.debian.org/DebianInstaller/Preseed). – NarūnasK Mar 14 '17 at 15:32
  • From a very brief look at the documentation it seems xcat is capable of orchestration via a variety of methods. I'd read the xcat documentation before you start deploying anything, and I would also look at ansible, kickstart, capistrano, puppet & chef as possible tools to help you through this. If you want my honest opinion I think you're thinking too far ahead of yourself and need to RTFM :) – Alex Berry Mar 14 '17 at 15:33
  • It sounds like you want a kickstart (RHEL/CentOS), AutoYAST(SUSE), or Preseed file, documentation for how to deploy all of these and the different configuration options is available – Matt Mar 14 '17 at 15:34
  • @AlexBerry I RTFM but I am a beginner in Linux that's why I'm asking here in Server Fault to get the knowledge from the best like you :) – NSD Mar 14 '17 at 15:50

4 Answers4

1

virt-clone - Clone a template VM

There are various ways mentioned in the comments on your question of how to automate the installation process, but none of them will allow you to use the operating system immediately.

In wonder if the best solution for you would be to install the Linux OS using the standard installer, and configure it how you need (maybe you already have a machine set up that you could use as a template).

Then use something like virt-clone (https://linux.die.net/man/1/virt-clone) to clone the existing VM. This way the new VMs will be ready almost instantly - you might need to adjust a few things - this can be done with virt-sysprep (http://libguestfs.org/virt-sysprep.1.html)

Google - there are some good guides out there.

If this suggestion isn't what you were looking for, I hope you find the right one :-)

bao7uo
  • 1,664
  • 11
  • 24
  • Thank you this sounds applicable. I will try it and let you know. However, what is the final output going to be? An iso or another file type? Because my aim is to boot my configured image on a slave vm via a master vm. – NSD Mar 14 '17 at 15:48
  • should be same as the original VM image, like a .img format but u can convert if necessary – bao7uo Mar 14 '17 at 16:39
1

There are quite a few ways to do that:

  1. set up a deployment server (theForeman, cobbler, fog etc) and install VMs via PXE
  2. use virt-install with a provided kickstart file
  3. use virt-builder (I think this is the closest fit to the way you put the request)
  4. use a template VM as a prototype for clones

There are more ways, but these are the most used, most obvious and easiest

dyasny
  • 18,482
  • 6
  • 48
  • 63
1

Maybe there are some iso files which directly install a default Virtual machine.

However i recommend you to install it yourself, at least once and the clone this machine if you need a fresh copy using https://linux.die.net/man/1/virt-clone.

You actually can install a headless VM with a headless host. Therefore the Host (kvm) creates a vnc display. Which will listen on Port 5900 (or whatever you set it to). Then you can connect from your normal PC to the host at port 5900 with something like TightVNC or UltraVNC and follow the installation steps as if you were installing a normal Linux version. You can even run a grafical VM inside a headless Server using this method, however i recommend using something resource friendly like LXDE.

mac.1
  • 149
  • 2
  • 5
  • 10
0

Server/Alternate versions of Debian/Ubuntu do not include a GUI; they can be easily used just by SSH connections disregarding the console.

If you want to avoid the typical interactive install you need a "preseed" file. The preseed file contains the answers to the interactive install questions.

If you are a Linux beginner please consider creating "automated" installs requires some effort, also if you want to create "customized" distros that requires even a bigger effort.

Pat
  • 3,339
  • 2
  • 16
  • 17