Unit 1: Linux Basics and Installation

CSE105 — Creative Engineering Workshop 7 min read

I. Orientation: The UNIX Heritage and the Linux Model

Linux is a free, open-source operating system kernel first released by Linus Torvalds in 1991, built to reimplement the design of UNIX (developed at AT&T Bell Labs, 1969, by Ken Thompson and Dennis Ritchie). A working "Linux" system pairs this kernel with the GNU userland tools, forming what is precisely called a GNU/Linux distribution.

  • Kernel vs. distribution: the kernel manages hardware and processes; a distribution (Ubuntu, Fedora, Debian) bundles the kernel with a shell, libraries, package manager, and desktop.
  • Open source (GPL licence): source code is publicly readable and modifiable; the GNU General Public License requires derivatives to remain free.
  • Multi-user, multitasking: many users and many processes run concurrently, each isolated by permissions.
  • "Everything is a file": devices, directories, and pipes are all accessed through the file interface in /dev, /proc, and the single root tree /.
  • Portability: written mostly in C, so the same source recompiles across CPU architectures (x86, ARM, RISC-V).

II. Introduction to Linux and UNIX

A. Definition and lineage

UNIX established the conventions that Linux inherits and reimplements without using UNIX source code.

  • UNIX origin: created for the PDP-7/PDP-11 minicomputers; rewritten in C (1973) to become portable.
  • Design philosophy: small tools that "do one thing well" and combine through pipes, e.g. ls | sort | head.
  • Linux as a clone: POSIX-compatible but independently coded; hence "UNIX-like" rather than certified UNIX.

B. Distinguishing UNIX and Linux

The two are structurally alike but differ in licensing and distribution.

  1. UNIX: proprietary, vendor-specific implementations (Solaris, AIX, HP-UX); source usually closed.
  2. Linux: free and community-driven; hundreds of distributions from one shared kernel.
  • Common ground: shell, hierarchical filesystem, permission model, and the same core commands.

III. UNIX Architecture

A. The layered model

UNIX is organised as concentric layers, each shielding the next from hardware detail.

  • Hardware: the physical CPU, memory, and I/O devices at the centre.
  • Kernel: the resident core controlling process scheduling, memory, device drivers, and file storage; the only layer running in privileged mode.
  • Shell: the command interpreter (e.g. bash, sh) that reads user commands and requests kernel services.
  • Applications/utilities: outermost layer of user programs and commands such as grep, cp, vi.

B. Kernel responsibilities

The kernel is the mediator between programs and hardware.

  • Process management: creates processes via fork() and replaces images via exec(); schedules CPU time slices.
  • Memory management: allocates virtual memory, handles paging and swapping to disk.
  • File system: organises data in the hierarchy rooted at / (/bin, /etc, /home, /usr).
  • Device management: exposes hardware as special files in /dev (e.g. /dev/sda for a disk).

C. System calls and the shell interface

User space requests kernel services only through a defined boundary.

TEXT
Application → system call (e.g. read(), write(), open()) → Kernel → Hardware
  • System call: the controlled entry point that switches from user mode to kernel mode.
  • Shell role: parses a typed command, locates the program, and invokes it as a new process.

IV. Ubuntu Installation

A. Purpose and preparation

Ubuntu is a Debian-based distribution installed from a downloadable ISO image using a guided graphical installer.

  • ISO image: the disc image (e.g. ubuntu-24.04-desktop-amd64.iso) written to bootable media.
  • Minimum requirements: roughly 4 GB RAM, 25 GB disk, and 64-bit processor for a current desktop release.
  • Boot order: the BIOS/UEFI is set to boot the installation media before the internal disk.

B. Installation steps and partitioning

The installer walks through language, keyboard, updates, and disk setup.

  • "Try or Install": the live environment lets you test before committing.
  • Partition scheme: typically an EFI system partition, a root / partition (ext4), and optional swap.
  • User setup: creates the first account, which gains administrative rights through sudo.
  • GRUB bootloader: installed to manage which OS starts at power-on.

V. Dual Boot Installation

A. Concept

Dual booting installs Linux alongside an existing OS (usually Windows) so either can be chosen at startup.

  • Bootloader menu: GRUB presents both systems and defaults after a timeout.
  • Separate partitions: each OS occupies its own region of the same disk; files remain isolated.

B. Procedure and precautions

Careful disk handling protects the pre-installed system.

  • Shrink Windows partition: free unallocated space using Windows Disk Management before installing.
  • Disable Fast Startup: prevents Windows from locking the shared disk in a hibernated state.
  • UEFI consistency: install both OSes in the same firmware mode (UEFI) so GRUB detects Windows.
  • Install order: installing Windows first, then Linux, lets GRUB pick up the Windows entry automatically.

VI. Virtual Machine Installation (VirtualBox/VMware)

A. Principle

A virtual machine runs Linux as a guest OS inside the host OS, using a hypervisor to emulate hardware.

  • Hypervisor: software (VirtualBox, VMware Workstation) presenting virtual CPU, RAM, disk, and NIC.
  • Isolation: the guest cannot affect the host disk directly, making it ideal for safe experimentation.
  • Virtual disk file: the guest's storage is a single file on the host (.vdi for VirtualBox, .vmdk for VMware).

B. VirtualBox and VMware compared

Both create VMs from the same ISO but differ in licensing and features.

  1. VirtualBox: free and open-source (Oracle); cross-platform; uses "Guest Additions" for display and clipboard integration.
  2. VMware Workstation Player: proprietary; often faster 3D and snapshot handling; uses "VMware Tools" for the equivalent integration.
  • Common setup: allocate RAM/CPU, create a virtual disk, attach the ISO, then install as if on real hardware.

VII. Live USB/CD Installation

A. Purpose

A live medium boots a fully working Linux session directly from USB or CD without touching the internal disk.

  • Live session: the OS runs in RAM and from the medium; changes vanish on reboot unless persistence is enabled.
  • Uses: testing hardware compatibility, rescuing a broken system, or launching the actual installer.

B. Creating and using live media

The ISO is written to media with dedicated imaging tools.

  • Imaging tools: Rufus or balenaEtcher on Windows; the dd command on Linux.
  • dd example: writes the ISO block-for-block to the USB device.
BASH
sudo dd if=ubuntu-24.04-desktop-amd64.iso of=/dev/sdb bs=4M status=progress
  • if: input file (the ISO); of: output device (the whole USB disk, not a partition); bs: block size for the copy.
  • Persistence: an optional extra partition stores changes across sessions.

VIII. Windows Subsystem for Linux (WSL)

A. Definition

WSL runs a genuine Linux environment directly on Windows without a full VM or dual boot.

  • WSL 1 vs WSL 2: WSL 1 translates Linux system calls to Windows; WSL 2 runs a real Linux kernel inside a lightweight managed VM, giving fuller compatibility.
  • Integration: Linux and Windows share the filesystem and can invoke each other's commands from either shell.

B. Installation and use

A single command installs the default distribution.

POWERSHELL
wsl --install
  • Effect: enables the required Windows features, installs the WSL 2 kernel, and pulls Ubuntu by default.
  • Distribution choice: wsl --list --online shows options; wsl -d <name> launches a specific one.
  • Best fit: developers wanting Linux tooling and shells while keeping Windows as the primary OS.

IX. Linux Desktop Environments (GNOME, KDE)

A. Role of a desktop environment

A desktop environment (DE) is the complete graphical layer, window manager, panels, file manager, and default apps, sitting above the display server (X11 or Wayland).

  • Separable from kernel: the same Linux can run any DE; users may install several and pick one at login.
  • Components: window manager, panel/taskbar, settings manager, and a suite of native applications.

B. GNOME

GNOME is the default DE for Ubuntu and Fedora, emphasising simplicity and a workflow-driven layout.

  • Activities overview: a single hotspot for search, open windows, and virtual workspaces.
  • Design goal: minimal clutter, consistent design language (GTK toolkit), fewer configurable options by default.
  • Resource profile: comparatively heavier on RAM due to its animations and shell design.

C. KDE

KDE Plasma prioritises configurability and a Windows-like familiarity.

  • Widgets and panels: almost every element can be moved, resized, or replaced through system settings.
  • Toolkit: built on Qt, with the "KDE Applications" suite (Dolphin file manager, Konsole terminal).
  • Contrast with GNOME:
    1. GNOME: opinionated, streamlined, fewer settings exposed.
    2. KDE: highly customisable, feature-dense, closer to a traditional desktop metaphor.
  • Efficiency: modern Plasma is notably light on resources despite its flexibility.