How To Setup Linux

How To Setup Linux

Reading time1 min
#Linux#Tech#OpenSource#Minimalism#Debian#Performance

Mastering the Minimalist Approach: How to Setup Linux for Maximum Efficiency

Pre-built Linux distributions promise plug-and-play convenience, but default installations rarely deliver optimal performance or transparency. Running a purpose-driven system requires assembling only the essential components—a process that exposes the underlying mechanics and strips away unnecessary overhead.

Consider the common scenario: a workstation or cloud VM saddled with GNOME, LibreOffice, and miscellaneous daemons the moment the install finishes. This approach consumes RAM, widens the attack surface, and costs power. For engineers responsible for resource-constrained servers, CI/CD containers, or hardened endpoints, minimalism is mandatory—not aesthetic.


Minimalism: Why Bother?

  • Performance: Idle footprint can drop below 100MB RAM. Baseline CPU utilization approaches zero.
  • Attack Surface: Fewer binaries, fewer CVEs, less maintenance overhead.
  • Customization: All services, shells, and tools are explicit install decisions.
  • Operational Insight: Direct interaction with system layer—init, networking, package management—cultivates real comprehension.

1. Choosing a Viable Minimal Base

Distro Selection: Not All Foundation Layers Are Equal

Base image matters. Some, like Ubuntu Server, ship with residual services and dependencies. For deliberate control, look at:

DistributionInstallerNotable Features
Debiannetinst ISOProven stability, granular tasksel
ArchBootstrap tarballZero extras, rolling release
AlpineMinimal ISOmusl-libc, hardened, tiny footprint
VoidBase rootfsrunit, independent packaging

Note: This walkthrough uses Debian 12 (Bookworm) netinst debian-12.5.0-amd64-netinst.iso. Expect kernel 6.1, coreutils, and APT.


2. Minimal Install: Strip It Back to Basics

  1. Download and verify SHA256 sums for Debian netinst ISO.
  2. Boot ISO—UEFI or legacy, doesn't matter for this scope.
  3. Proceed through the installer until “Software selection.”
  4. Deselect all—especially Gnome/KDE/XFCE/Desktop Environment, “Web server,” and “print server.”
  5. Only enable “standard system utilities” (optional; barebones can skip these too).

On reboot, the system presents a shell login: pure command-line Debian.

Debian GNU/Linux 12 bookworm tty1

bookworm login: _

Gotcha: Network interfaces may default to predictable names (e.g., enp1s0 not eth0). Adjust configs as needed.


3. First-Boot Housekeeping

Update repo data and patch everything to current:

sudo apt update && sudo apt full-upgrade -y

Essential Packages

On most headless setups install (replace vim if you’re in the Emacs camp):

sudo apt install -y vim less htop curl ca-certificates git

Networking: If netplan/wicked/network-manager isn’t present, you’ll likely default to ifupdown. To manage via NetworkManager (useful for laptops or WiFi):

sudo apt install -y network-manager
sudo systemctl enable --now NetworkManager

Enable SSH for remote provisioning:

sudo apt install -y openssh-server
sudo systemctl enable --now ssh

Returned error:

Could not load host key: /etc/ssh/ssh_host_ed25519_key: No such file or directory

Means sshd-keygen was skipped. Regenerate with:

sudo dpkg-reconfigure openssh-server

4. (Optional) X11 & Window Manager: Minimal GUI

Need a graphical session? Stay light.

sudo apt install -y xorg xinit i3

Set up .xinitrc:

echo "exec i3" > ~/.xinitrc

Start with:

startx

Side note: Xorg packages drift—track actual dependencies. Even on minimal installs, expect ~130MB extra after the above. Consider using apt install -y --no-install-recommends xorg i3 to trim further.


5. Selective Software: Only Add What Delivers Value

Resist “install everything.” Example workflows:

Use CasePackage(s)Command
Browsingfirefox-esr, lynxsudo apt install firefox-esr
File browsingmc, rangersudo apt install mc
Text editingvim, nanosudo apt install vim
Terminal multiplexertmux, screensudo apt install tmux

Question: Why not sudo apt install libreoffice? Minimalist setups avoid suites that pull >400MB in split dependencies.


6. System Hardening and Performance Tuning

Service pruning: Disable anything extraneous.

systemctl list-unit-files --state=enabled
sudo systemctl disable bluetooth ModemManager avahi-daemon

Monitoring:
Install and use htop, iotop, free -h for metrics.

sudo apt install -y htop iotop
htop

Firewall: Block everything except required ports.

sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw allow ssh  # if you're using remote shell
sudo ufw enable

Automatic security updates:

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

Trade-off: unattended-upgrades can introduce downtime if kernel/hardware stack gets replaced without notice. In production, always test patching flows before enabling auto-apply.


7. Repeatability: Scripting Your Baseline

Automate installation for faster deployment. Sample minimal-setup.sh:

#!/bin/bash
apt update && apt -y full-upgrade
apt install -y vim i3 network-manager openssh-server ufw htop
systemctl enable --now ssh ufw NetworkManager
ufw allow ssh
ufw enable

Non-obvious tip:
Version-control this script. When distributing across a fleet, fingerprint resulting installations with debsums to detect drift.


Imperfect by Design

No single minimal system fits all use cases. On cloud images, skip X entirely; for developer laptops, install select GUI tools as needed. For reproducibility, consider moving towards declarative models: Ansible, NixOS, or containerized homedir overlays.

This workflow demands continual review—kernel and userspace evolve, and what was “minimal” last year bloats over time, e.g. systemd service sprawl.


Summary

Minimalist Linux setups are about control and clarity. By stripping a distribution to its essentials and assembling only the parts you need, you unlock both performance and true understanding. The tradeoff? Increased responsibility. However, for those managing production workloads, developer workstations, or secure endpoints, it’s worth the diligence.

The best minimal system is the one that serves your purpose—nothing more, nothing less.