How To Install Linux In Vmware

How To Install Linux In Vmware

Reading time1 min
#Linux#VMware#Virtualization#LinuxInstallation#VMwareSetup#LinuxVM

Deploying Linux in a virtualized environment like VMware Workstation Pro or VMware Player is routine for DevOps workstations, test labs, and CI pipeline agents. However, configuration nuances catch even experienced engineers off guard—especially around kernel compatibility and guest utilities.

Pre-requisites

  • VMware Workstation Pro (v17.5.0) or VMware Player (v17.x)
  • Linux ISO image (e.g., Ubuntu 22.04 LTS ubuntu-22.04.4-desktop-amd64.iso)
  • At least 2 vCPUs, 4GB RAM (adjust based on workload)
  • Enough disk space—20GB minimum for modern distros

Note: Nested virtualization and hardware virtualization (Intel VT-x or AMD-V) must be enabled at BIOS/UEFI.

Typical Workflow

  1. Create a New Virtual Machine

    Select “Custom (advanced).” Choosing default (“Typical”) often misses critical guest tuning options.

  2. Allocate Resources

    • CPU: Assign 2 cores minimum. For compilation or container workloads, 4+ cores recommended.
    • Memory: 4096 MB for desktop Linux; for headless servers, 2048 MB may suffice.
    • Disk: Use a single file VMDK for faster disk I/O on non-SSD hosts. Thin provisioning saves space, but pre-allocated (“eager zeroed”) reduces fragmentation.

    Gotcha: If disk size is too small, expanding later is possible but requires downtime and additional gparted or LVM steps.

  3. Mount ISO and Boot

    After creation, edit VM settings. Under CD/DVD, “Use ISO image file” and select your ISO. Disable “Connect at power on” for USB controllers if not required—improves stability on some laptop hosts.

    Power on. The VM should present the Linux boot menu. If you see a “No bootable device” error, double-check ISO attachment and boot order.

  4. Install Linux

    Proceed through distro installer UI—language, region, user/password creation. Stick with default partitioning on first pass unless you need LVM or custom filesystems (e.g., XFS for large data workloads).

    Known Issue: Some installer kernels lack drivers for VMware's default virtual NIC, especially on rolling distros (e.g., Arch, openSUSE Tumbleweed). If install hangs at network detection, temporarily switch NIC to “e1000” in VM hardware.

  5. Post-Install Configuration

    • VMware Tools: Critical for shared clipboard, dynamic screen resizing, and guest time sync. For Ubuntu, install open-vm-tools:
      sudo apt update
      sudo apt install open-vm-tools open-vm-tools-desktop
      sudo systemctl restart vmtoolsd
      
    • Display tuning: If graphics are sluggish, consider switching to “Accelerate 3D graphics” in VM settings.
    • SSH access (optional): sudo apt install openssh-server for remote administration.

    Practical example: A misconfigured VM network adapter leads to errors like:

    NetworkManager[525]: <error> [time] device (eth0) link timed out
    

    Resolution: Stop the VM, change network adapter type to “Bridged” for direct LAN access or “NAT” for isolated lab networks.

  6. Snapshot Baseline

    Before you patch, snapshot the clean install. This avoids lengthy re-installs after an experiment goes sideways. Never skip this in CI runners that mutate system state.

Non-Obvious Tips

  • Disable “Accelerate 3D Graphics” on minimal Linux VMs—otherwise, you’ll see high CPU usage from vmwgfx kernel modules.
  • Kernel upgrades in Ubuntu VMs (6.5.x+) sometimes require a manual reinstall of open-vm-tools. Don’t rely on automatic services.
  • For infrastructure automation, generate your VM with a cloud-init-enabled ISO and pre-provision via seed.iso.

Table: Key VM Configuration

SettingValue (Recommended)Notes
vCPU2+More for dev/test environments
RAM4096 MBLower for CLI-only
Disk20 GB, pre-allocatedExpand as needed
Network AdapterNAT or BridgedCustom config for isolated labs
Graphics3D disabled (server)Enable only for desktop workloads

Alternatives exist: KVM/QEMU offers better performance for Linux-on-Linux hosts, but VMware is preferred for Windows hosts and cross-platform portability.

There’s no shortcut for reading logs and troubleshooting initialization failures—dmesg, syslog, and the VMware log files under the VM directory are indispensable for root-cause analysis.