Skip to content

Installing Linux

Overview

This chapter introduces how to install the Linux operating system. We will cover multiple installation methods, from the most suitable virtual machine installation for beginners, to dual-boot and full installations.

Pre-Installation Preparation

1. Choose a Distribution

For beginners, the following distributions are recommended:

  • Ubuntu: Most popular, good community support, suitable for getting started
  • Linux Mint: Based on Ubuntu, offering a more traditional desktop experience
  • Fedora: More recent software, suitable for developers

2. Download ISO Image

Download the ISO image file from the official website:

3. Verify Downloaded Files

After downloading, it's recommended to verify file integrity:

bash
# Calculate SHA256 checksum
sha256sum ubuntu-24.04-desktop-amd64.iso

# Compare with the checksum provided on the official website

Installation Method Selection

Advantages:

  • Does not affect existing system
  • Can create snapshots at any time
  • Convenient to try different distributions

Disadvantages:

  • Performance has overhead
  • Cannot use full hardware resources

Method 2: Dual-Boot Installation

Advantages:

  • Can experience the complete Linux
  • Retain existing operating system

Disadvantages:

  • Installation process is more complex
  • Requires reboot to switch systems

Method 3: Full Installation

Advantages:

  • Best performance
  • Complete Linux experience

Disadvantages:

  • Will overwrite existing system
  • Need to backup important data

Method 4: WSL (Windows Subsystem for Linux)

Advantages:

  • Windows users can quickly experience Linux
  • No need to reboot to switch

Disadvantages:

  • Not a complete Linux experience
  • Some features are limited

Virtual Machine Installation (Detailed Steps)

Installing VirtualBox

Windows Users

  1. Visit https://www.virtualbox.org/
  2. Download the Windows installer
  3. Run the installer and follow the prompts to complete installation

macOS Users

bash
# Install using Homebrew
brew install --cask virtualbox

Linux Users

bash
# Debian/Ubuntu
sudo apt install virtualbox

# Fedora
sudo dnf install virtualbox

# Arch Linux
sudo pacman -S virtualbox

Creating a Virtual Machine

  1. Open VirtualBox, click "New"

  2. Configure virtual machine name and type

    • Name: Ubuntu (or any name)
    • Type: Linux
    • Version: Ubuntu (64-bit)
  3. Allocate memory

    • Recommend at least 2GB (2048 MB)
    • If host memory is sufficient, allocate 4GB or more
  4. Create virtual hard disk

    • Select "Create a virtual hard disk now"
    • Hard disk file type: VDI
    • Storage on physical hard disk: Dynamically allocated
    • Size: Recommend 25GB or larger
  5. Configure virtual machine settings

    • System → Processor: Allocate 2 or more CPU cores
    • Display → Video Memory: 128 MB
    • Storage → Add ISO image to optical drive

Installing Ubuntu

  1. Start the virtual machine

    • Select the virtual machine and click "Start"
  2. Select language

    • Select "中文(简体)"
  3. Select installation type

    • Click "Install Ubuntu"
  4. Keyboard layout

    • Select "Chinese" or "English (US)"
  5. Installation options

    • Normal installation (includes common software)
    • Check "Download updates while installing"
  6. Installation type

    • Select "Erase disk and install Ubuntu"
    • (This is safe in a virtual machine)
  7. Timezone settings

    • Select Shanghai
  8. Create user

    • Enter your name
    • Set computer name
    • Create username
    • Set password
  9. Wait for installation to complete

    • Installation usually takes 10-20 minutes
  10. Restart system

    • After installation is complete, click "Restart now"
    • Remove installation media as prompted

Installing Guest Additions

Installing VirtualBox Guest Additions provides better experience:

bash
# Open terminal in virtual machine and execute:
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)

# Then in VirtualBox menu select:
# Devices → Install Guest Additions

Dual-Boot Installation

Preparation Work

  1. Backup important data

    • This is very important!
  2. Create bootable USB

    Use Rufus (Windows) or Etcher (cross-platform):

    # Using Etcher
    1. Download and install Etcher
    2. Select Linux ISO image
    3. Select USB drive
    4. Click Flash to begin writing
  3. Make space for Linux

    In Windows:

    • Right-click "This PC" → Manage → Disk Management
    • Select a partition, right-click "Shrink Volume"
    • Allocate at least 50GB space for Linux
  4. Disable Windows Fast Startup

    • Control Panel → Power Options → Choose what the power buttons do
    • Uncheck "Turn on fast startup"

Installation Steps

  1. Boot from USB

    • Restart computer, enter BIOS/UEFI
    • Set USB as first boot device
    • Or use boot menu (usually F12 or F2)
  2. Select "Install Ubuntu"

  3. Select installation type

    • Select "Install Ubuntu alongside Windows Boot Manager"
    • Or select "Something else" for manual partitioning
  4. Manual partitioning (optional)

    Recommended partitioning scheme:

    PartitionSizeFile SystemMount Point
    EFI512 MBFAT32/boot/efi
    Root30-50 GBext4/
    SwapEqual to RAMswap-
    HomeRemaining spaceext4/home
  5. Complete installation

    • Follow the installation wizard to complete remaining steps
    • After restart, you will see GRUB boot menu

WSL Installation (Windows 10/11)

Enable WSL

powershell
# Run PowerShell as administrator
wsl --install

Install Specific Distribution

powershell
# View available distributions
wsl --list --online

# Install Ubuntu
wsl --install -d Ubuntu

# Install other distributions
wsl --install -d Debian

WSL Basic Configuration

powershell
# Set default distribution
wsl --set-default Ubuntu

# View installed distributions
wsl --list --verbose

# Set WSL version
wsl --set-version Ubuntu 2

Starting and Using

powershell
# Start default distribution
wsl

# Start specific distribution
wsl -d Ubuntu

# Start as root user
wsl -u root

Post-Installation Basic Configuration

1. Update System

bash
# Debian/Ubuntu
sudo apt update && sudo apt upgrade -y

# Fedora
sudo dnf update -y

# Arch Linux
sudo pacman -Syu

2. Install Common Software

bash
# Debian/Ubuntu
sudo apt install vim git curl wget htop

# Fedora
sudo dnf install vim git curl wget htop

3. Configure Chinese Input Method

bash
# Ubuntu
sudo apt install ibus-pinyin

# Then add Chinese input method in Settings

4. Install Graphics Drivers (if needed)

bash
# Ubuntu - NVIDIA drivers
sudo ubuntu-drivers autoinstall

# Or install manually
sudo apt install nvidia-driver-535

5. Configure Terminal

bash
# Install Oh My Bash (optional)
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"

Common Problem Solutions

1. UEFI Secure Boot Issue

If unable to boot from USB:

  • Enter BIOS settings
  • Disable Secure Boot
  • Or use signed boot loader

2. Partition Issues

If installation program cannot recognize hard drive:

  • May need to disable Intel RST
  • Change SATA mode to AHCI in BIOS

3. Wireless Adapter Not Working

bash
# View network card information
lspci | grep -i wireless
lsusb | grep -i wireless

# Install additional drivers
sudo apt install linux-firmware

4. Time Not Synchronized (Dual-Boot)

bash
# Make Linux use local time
timedatectl set-local-rtc 1 --adjust-system-clock

Getting Help

If you encounter problems during installation:

  1. Official Documentation

  2. Community Forums

  3. Search Engines

    • Searching with error messages usually finds solutions

Summary

This chapter introduced multiple ways to install Linux:

  • Virtual Machine Installation: Most suitable for beginners, safe and convenient
  • Dual-Boot Installation: Can experience complete Linux
  • WSL: Convenient choice for Windows users

Recommend beginners first use a virtual machine to become familiar with Linux, then consider dual-boot or full installation.


Previous chapter: Linux Introduction

Next chapter: Desktop Environment

Content is for learning and research only.