Title: Install Linux on a Virtual Machine
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

There are several options for installing Linux depending on the type of network and the available media.  As seen in the previous section, a PXE server, a bootable ISO image, or a repository URL are all valid sources.  In addition a kickstart file can be used with any of these methods to pre-select installation options or to fully automate the installation.

By selecting the appropriate --os-variant option, libvirt will automatically select the best virtual hardware for the virtual machine.  For example, the storage controller can be "ide", "fdc", "scsi", "sata", "usb", "ccid", or "virtio-serial".  If you select a newer version of Linux, libvirt will select the virtio-serial controller device, which is very fast but is not supported on older versions of Linux.   The ide device is supported in all operating systems, but it is more resource intensive and has a greater latency for disk access.  Unless you are testing, it is best to let libvirt select the storage contoller and network adapter.

During the installation process, all virtual hardware should be properly discovered, and the right kernel modules will be loaded.  Installation will proceed identical to the process for real hardware.

After the installation has been completed, it is a good idea to run "chkconfig smartd off" and "service smartd stop".  Since the hard drives are virtual, there is no need to have the SMART daemon running tests on the devices.  At this point, the virtual machine can be managed in the same way that servers on real hardware are managed, including starting, shutting down, and applying security updates.

One nice feature with libvirt is that it remembers which virtual machines are running when the host is shut down.  Libvirt will first suspend each of the running guests as part of the shutdown process.  When the host is booted, it finds the guests which were suspended prior to shutdown and  restarts them.  This is very convenient when maintenance is required on the host, since the guests do not need special attention.