Fundamentals of Virtualization · Lesson 6
Installing Linux on a Virtual Machine
Install Ubuntu in VirtualBox, add Guest Additions, inspect guest-visible resources, and tune Linux services, packages, timing, and metrics.
Lesson purpose
Linux is a major server and cloud operating system because it offers broad hardware support, open-source ecosystems, flexible distributions, and lower licensing costs in many situations. This lesson applies the same VM-installation model used for Windows to Ubuntu Linux in VirtualBox, then adds Linux-specific concerns: disk-layout warnings, superuser permissions, daemons, packages, time synchronization, and metrics.
Learning objectives
By the end of the lesson, students should be able to:
- Explain why Linux is common in server and cloud virtualization.
- Create a Linux VM with deliberate CPU, memory, disk, and ISO settings.
- Install Ubuntu while understanding that disk erase and format operations affect virtual disks.
- Install VirtualBox Guest Additions and explain their relationship to guest integration.
- Inspect Linux processes, resources, and mounted file systems from inside the VM.
- Optimize a Linux VM by reducing unnecessary services and packages and by maintaining reliable time and performance baselines.
1. Why Linux is common in virtual environments
Linux is an open-source operating system derived from UNIX traditions and available in many distributions. Older proprietary UNIX platforms remain important in some environments, but organizations often migrate suitable workloads toward Linux to reduce licensing costs, avoid vendor lock-in, use commodity hardware, and access a broad set of current application frameworks.
Linux also fits cloud and container ecosystems. Open-source databases, analytics platforms, automation tools, and cloud infrastructure projects commonly support Linux first or use it as a foundation. Virtualization lets Linux and Windows guests run side by side on the same physical host, so choosing Linux does not require a separate hardware silo.
Cost is only one factor. Evaluate the distribution, support model, security updates, application compatibility, administration skills, performance requirements, and lifecycle policy. “Open source” does not mean “no operational cost” or “no need for support.”
2. Create the Linux VM in VirtualBox
The book’s example uses Oracle VM VirtualBox, a Type 2 hypervisor, and a 64-bit Ubuntu Desktop ISO. The walk-through is one supported path rather than a universal recipe. Product names and installation screens change, but the configuration reasoning stays stable.
The example configuration is:
- 1 virtual CPU.
- 1 GB of memory.
- A 20 GB virtual disk.
- A VDI disk file with dynamic allocation.
- An Ubuntu ISO connected to the virtual optical drive.
The creation sequence is:
- Open VirtualBox and choose New.
- Enter a meaningful VM name and select the Linux type and correct version.
- Set memory without starving the host.
- Create a virtual hard disk, choose the supported disk-file format, and select dynamic allocation when appropriate.
- Set the virtual disk’s maximum capacity and file location.
- Open the VM’s storage settings and attach the trusted Ubuntu ISO to the virtual optical drive.
- Start the VM and boot from the ISO.
Dynamic allocation saves host storage initially and grows as the guest writes data, but it can eventually fill the host datastore. A virtual disk’s maximum size is not the same as its current physical consumption.
3. Install Ubuntu and interpret disk warnings
The Ubuntu installer follows the physical-server pattern: choose the installation option, configure updates, select a disk layout, set the time zone and keyboard, create the machine name and user, install files, and reboot. The example enables downloading updates during installation and chooses “Erase Disk and Install Ubuntu.”
The warning is important in a VM. “Erase disk” applies to the virtual disk assigned to this VM, not automatically to every physical disk in the host. Students must still verify the selected device and the VM boundary before confirming. A mistake in a passthrough or direct-device configuration can have physical consequences, so never treat a warning as harmless without checking the storage mapping.
After installation, disconnect or eject the ISO if the VM boots into the installer again. Log in, confirm the expected hostname and network behavior, apply updates, and make sure the guest’s identity is appropriate for the lab or production environment.
4. Install VirtualBox Guest Additions
Guest Additions are VirtualBox’s guest-integration package. Like VMware Tools, they combine drivers and services that can improve:
- Mouse integration and display support.
- Time synchronization.
- Shared folders and clipboard behavior.
- Guest status reporting and other host-guest interactions.
- Performance compared with generic emulated devices.
The example inserts the Guest Additions CD image from the Devices menu, runs the installer, authenticates with a password, waits for packages to compile or install, and then ejects the image. Linux installation may require root or superuser privileges because drivers and system services are being added.
Guest Additions are not mandatory for Linux to boot, but they are strongly recommended when the platform supports them. They are also software that must be kept compatible with the VirtualBox release and guest kernel. Shared folders and clipboard features cross the isolation boundary, so enable them only for a clear reason.
5. Inspect the Linux VM
The Linux guest sees only its assigned virtual hardware. The example sees 1 GB of memory and a 20 GB virtual disk with about 14.4 GB available after installation. It does not see the host’s full memory or storage pool.
Use the guest tools to build an evidence-based view:
- Displays: confirm resolution and test that the guest integration driver behaves correctly.
- Processes tab: inspect process names, owners, process IDs, priorities, CPU use, and memory use.
- Resources tab: watch live CPU, memory, and network charts to see whether the VM is idle or stressed.
- File Systems tab: identify mounted file systems and their capacity.
- File browser: confirm that the expected storage is visible from the guest.
The VM can access a network through a virtual adapter and the host’s physical path, but a working adapter does not prove that DNS, routing, firewall, VLAN, or external connectivity is correct. Inspect each layer separately.
6. Optimize Linux services and packages
A generic Linux installation may start daemons, graphical features, and packages that are not needed for the VM’s role. Every running service consumes some CPU, memory, storage, logging, and administrative attention. Reducing the installation can improve performance and reduce attack surface, but removal must be based on the workload and distribution documentation.
Optimization practices include:
- Inventory services and identify which daemons the application actually needs.
- Disable or remove unnecessary daemons through the distribution’s supported service-management tools.
- Install only required packages rather than a large desktop or application suite.
- Keep the kernel, Guest Additions, applications, and security updates current.
- Document changes so the VM can be rebuilt or audited.
The text uses the NOOP I/O scheduler and disabling NFS daemons as examples of workload-specific decisions. These are not universal commands or recommendations for every current Linux release. Modern kernels and distributions choose schedulers and service defaults differently, so validate with current vendor guidance and measurements.
7. Maintain reliable time
Time is used for logs, authentication, certificates, transactions, scheduled jobs, databases, and cluster coordination. Virtual machines do not have an independent physical clock source in the same way a standalone server does. Guest time can drift because of scheduling pauses, host behavior, or guest-kernel details.
Network Time Protocol (NTP) synchronizes systems with trusted time sources. A typical design is to keep the host synchronized and configure the guest according to the hypervisor and Linux distribution’s current recommendations. Guest integration can assist with host-guest time synchronization, but it does not remove the need for a coherent time architecture.
Teach students to verify time rather than assume it: compare the guest clock, host clock, configured time source, synchronization status, and logs. Time synchronization is less troublesome in newer kernels, but it remains an operational dependency.
8. Use metrics as a performance baseline
A VM cannot be judged by appearance or by one momentary CPU percentage. Before a physical-to-virtual conversion or major workload change, capture baseline measurements. Repeat them after installation, optimization, application updates, or host changes.
Useful evidence includes CPU utilization and ready or wait time, memory pressure and swapping, disk latency and throughput, network throughput and errors, process behavior, and application response time. Metrics help answer whether a change improved the service, merely moved a bottleneck, or created a new one.
Classroom application
Have students build or inspect an Ubuntu VM and submit a short configuration record:
- Distribution and version, ISO source, checksum or trust decision, and VM firmware.
- vCPU, memory, disk format, maximum capacity, current host consumption, and network mode.
- What the “erase disk” warning means in this VM and which device is selected.
- Guest Additions status and one host-guest feature that is intentionally enabled or disabled.
- A screenshot or transcription of process, resource, and file-system observations.
- One daemon or package that is unnecessary for the chosen role, the evidence for that decision, and a rollback plan.
Checks for understanding:
- Why can Linux and Windows share one physical host without sharing one guest kernel?
- Why is a dynamically allocated disk both useful and risky?
- Why might a student need superuser privileges to install Guest Additions?
- What problems can an incorrect guest clock create even when CPU and memory look healthy?
Common misconceptions
- “Linux is free, so it needs no administration.” Licensing cost and operational responsibility are different questions.
- “Erase disk means erase the host.” It normally targets the selected virtual disk, but the mapping must be verified before confirmation.
- “Guest Additions are required for Linux to run.” They improve integration and performance but are not the guest operating system.
- “A low CPU chart proves good performance.” The bottleneck may be memory, disk latency, network, timeouts, or an application dependency.
- “Disable every daemon.” A service may be required for the workload, security, storage, networking, or management.
Lesson summary
Linux is a flexible and widely used virtualization guest, especially in server, cloud, and open-source environments. The VM creation and installation sequence mirrors physical-server work, but students must reason carefully about virtual disks, ISO boot, allocations, and the host boundary. Guest Additions improve VirtualBox integration, while Linux tools reveal processes, resources, and file systems from inside the guest. Production quality comes from workload-specific service and package choices, reliable time synchronization, current updates, and repeated performance measurements.
Course Notes