Skip to main content
Cloud images with pre-installed operating systems can simplify deployments by eliminating the OS installation step. However, in some cases, you may want to perform a fresh operating system installation on a virtual machine. This guide explains how to set up a virtual machine using a virtual CD-ROM/DVD-ROM and an empty disk image, then install an operating system using the virt-install tool.
The image illustrates the process of installing an operating system on a virtual machine using a virtual CD/DVD drive.

Overview of the Process

The installation process involves the following key differences compared to importing a pre-built disk image:
  1. The --import option is omitted because no pre-installed operating system exists.
  2. The --disk option uses the syntax size=10 (or another size) to create a new disk image with a specified capacity.
  3. The --location option points to an ISO file or a URL serving as a virtual installation medium.
  4. The --graphics none option enforces a text-mode installation.
  5. The --extra-args "console=ttyS0" option configures the Linux kernel to expose a serial console, enabling text-based interactions without a graphical interface.

Example: ISO-Based Installation

Below is a sample command demonstrating the installation process using an ISO-based installer:
The virt-install command begins by downloading necessary installation files and proceeds with the configured setup. An extended version of the command is shown below:
As the setup continues, kernel output is generated, displaying messages similar to the following:
After the kernel completes its startup messages, the system boots directly into the Debian installer. In text-based terminal environments, the display might sometimes seem misaligned. Since the installation interface is minimal, not all languages or options may be available. You can simply press Enter to accept the default options during the initial setup.
The image shows a text-based installation screen prompting the user to select a language, with "English" highlighted as the current selection.
For demonstration purposes, this guide stops at the installer boot stage. Continuing the process would trigger additional downloads and extended waiting times. If you wish to cancel the installation, press Ctrl+] to exit the terminal session.
Please note that terminal outputs may sometimes appear distorted. In such situations, using the clear command might not fully resolve display issues.

Summary

This guide demonstrated how to create a virtual machine and perform a complete operating system installation from scratch using the virt-install tool. While pre-built cloud images are generally more efficient, understanding this process is valuable for instances that require a fresh installation setup. This concludes the demonstration.

Watch Video

Practice Lab