...

Running Linux on Windows: WSL vs VirtualBox

ghwangbo 2025. 5. 30. 14:38
반응형

1. What is WSL?

  • WSL (Windows Subsystem for Linux) is a feature built into Windows 10 and later that lets you run a Linux environment directly on Windows without a virtual machine.
  • It provides a lightweight Linux kernel compatibility layer integrated tightly with Windows.
  • Ideal for developers who want quick access to Linux command-line tools without full virtualization.
  • Limitations: WSL has no full Linux GUI support by default (WSL2 improves this), and it shares resources with Windows, so it may not be ideal for heavier workloads or full Linux desktop environments.

2. How to Install and Use WSL

Step 1: Enable WSL on Windows

  1. Open PowerShell as Administrator.
  2. Run the command:This will enable the necessary components, install the latest WSL version (WSL 2 by default), and install Ubuntu Linux by default.
     
     
  3. Restart your computer if prompted.
wsl --install

Step 2: Set Up Your Linux Distribution

  1. After restart, open the Windows Terminal or Command Prompt.
  2. Type:This will launch your Linux shell.
     
     
  3. The first time you run it, it will prompt you to create a new UNIX username and password.
wsl

Step 3: Use WSL

  • You now have a full Linux command-line environment integrated with Windows.
  • Access your Windows files inside WSL under /mnt/c/ for C:\ drive.
  • You can install Linux packages using standard package managers like apt
sudo apt update sudo apt install <package-name>

Optional: Installing Other Linux Distros

  • Open the Microsoft Store.
  • Search for other distros like Debian, Kali Linux, Fedora Remix, etc.
  • Install and run them independently.

Optional: GUI Support (WSL2)

  • Windows 11 and some Windows 10 versions support running Linux GUI apps directly on WSL2.
  • No extra setup needed beyond WSL2 installation and your distro being updated.

3. What is VirtualBox?

  • VirtualBox is a free, open-source virtualization software that lets you run a complete Linux operating system inside a virtual machine (VM) on your Windows PC.
  • You install a full Linux OS ISO (e.g., Ubuntu, Fedora) inside VirtualBox.
  • Provides full Linux kernel and desktop environment with isolated hardware resources.
  • Allows running multiple OSes simultaneously and fully isolated from the host Windows.
  • Suitable for development, testing, and learning full Linux environments.
  • Requires more disk space, CPU, and RAM resources than WSL because it runs a full OS virtualized.

4. Using VirtualBox to Run Linux on Windows

Step 1: Install VirtualBox

  1. Download VirtualBox from the official website: https://www.virtualbox.org/
  2. Run the installer and follow the prompts.

Step 2: Download Linux ISO

Step 3: Create a New Virtual Machine (VM)

  1. Open VirtualBox and click New.
  2. Name your VM (e.g., Ubuntu Linux).
  3. Select Linux as the type and the appropriate version (e.g., Ubuntu 64-bit).
  4. Allocate RAM (recommend at least 2 GB).
  5. Create a new virtual hard disk (recommended at least 20 GB).

Step 4: Attach the ISO to VM

  1. Select the VM and click Settings.
  2. Go to Storage.
  3. Under the IDE Controller, select the empty CD/DVD drive.
  4. Click the disk icon next to Optical Drive and choose the Linux ISO file you downloaded.

Step 5: Boot and Install Linux

  1. Start the VM.
  2. It will boot from the ISO.
  3. Follow the Linux installation wizard to install the OS inside the VM.
  4. Once installed, remove the ISO from the virtual drive and reboot the VM.

Step 6: Use Linux in the VM

  • You now have a full Linux OS running on Windows inside VirtualBox.
  • You can run Linux GUI apps, install software, and use it like a regular Linux machine.

5. Comparing WSL and VirtualBox

FeatureWSLVirtualBox
Installation Very easy via Microsoft Store More complex, requires ISO & setup
Performance Lightweight, fast boot Heavier, needs more resources
GUI Support Limited (WSL2 improved) Full GUI support
Linux Kernel Uses Windows-compatible kernel Full Linux kernel
Isolation Shares Windows resources Fully isolated OS
Disk Space Small footprint Larger (virtual disk file)
Use Cases Quick CLI tasks, scripting Full Linux desktop, development
 

Summary

  • Use WSL if you want quick access to Linux command-line tools with minimal setup.
  • Use VirtualBox if you need a full Linux environment with GUI and isolated resources.
반응형