123DevOps··11 min read

Debian Linux installation: from USB stick to your first apt-get and vim

Install Debian 13 step by step: pick and verify the ISO, write the USB stick with dd, go through every installer screen, and learn the basics of sudo, apt-get, security updates, and vim.

Linux

Debian is the distribution that runs for years on a forgotten server without giving anyone trouble, and it’s also the base of Ubuntu. In this guide, you’ll go from downloading the ISO to an up-to-date system, with sudo working and vim under control.

Why Debian (and which version to install)

Debian is maintained by a community of volunteers, not by a company. That means careful releases, thoroughly tested packages, and a clear rule about what counts as free software. For servers and for learning Linux in depth, it’s an excellent choice.

The current stable release is Debian 13 “trixie”, released on August 9, 2025. The latest point release is 13.8, from November 21, 2026. Trixie uses the Linux 6.12 kernel and ships GNOME 48, KDE Plasma 6.3, Xfce 4.20, and LXQt 2.1. Debian 12 “bookworm” is now oldstable and gets LTS support until June 30, 2028.

Install type Minimum RAM Recommended RAM Disk
No desktop 512 MB 1 GB 4 GB
With desktop 1 GB 2 GB 10 GB

The graphical installer needs more than 780 MB of RAM. Below that, use the text installer.

Downloading the right image

netinst, DVD, or live?

The debian.org/download page points straight to the netinst image (debian-13.8.0-amd64-netinst.iso). It’s small and downloads the rest of the packages from the internet during installation.

Image When to use it
netinst The default for most people: small ISO, always up-to-date packages, needs a network
DVD (DVD-1) Machines with poor internet or offline installs
Live (GNOME, KDE, Xfce…) Try the desktop first; installation uses Calamares, not the classic installer

All ISOs are hybrid: they work on a DVD or written straight to a USB stick.

What about firmware?

Wi-Fi cards and some GPUs need non-free firmware. Since Debian 12, the official images already include it, and the non-free-firmware component is enabled by default.

Verifying the ISO with SHA512SUMS and the signature

Verifying the ISO ensures it wasn’t corrupted or tampered with. Each image directory has SHA512SUMS and its signature, SHA512SUMS.sign. The official verification page doesn’t print the commands; the ones below are the standard usage of GnuPG and sha512sum and were not run for this article:

# In the same folder as the ISO
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA512SUMS
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA512SUMS.sign

gpg --keyserver keyring.debian.org --recv-keys DF9B9C49EAA9298432589D76DA87E80D6294BE9B
gpg --verify SHA512SUMS.sign SHA512SUMS
sha512sum -c --ignore-missing SHA512SUMS

In the gpg --verify output, look for “Good signature” from the “Debian CD signing key”, with the fingerprint DF9B 9C49 EAA9 2984 3258 9D76 DA87 E80D 6294 BE9B. A warning that the key is not “certified” is normal. In the sha512sum output, the line for your ISO must end in OK.

Writing the USB stick with dd

dd writes raw bytes to whatever device you point it at, without asking. If you pick the wrong device, you wipe the wrong disk, including your system disk. So run lsblk before and after plugging in the stick, and compare:

lsblk    # before plugging in the USB stick
lsblk    # after plugging it in: the new disk is the USB stick
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 476.9G  0 disk
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 476.4G  0 part /
sdb      8:16   1  14.9G  0 disk
└─sdb1   8:17   1  14.9G  0 part /media/user/USBSTICK

In this illustrative output, the USB stick is sdb: it showed up afterward, it’s removable (RM = 1), and it has the right size. Write to the whole disk (/dev/sdb), never to the partition (/dev/sdb1). This is the command from Debian’s official FAQ:

sudo umount /dev/sdX1    # if the system mounted the stick automatically
sudo dd if=debian-13.8.0-amd64-netinst.iso of=/dev/sdX bs=16M status=progress oflag=sync

Replace sdX with the right name. The installation guide shows an equivalent alternative with cp debian.iso /dev/sdX followed by sync.

On Windows, the Debian FAQ recommends balenaEtcher or USBImager. The guide also warns against tools that alter the image, such as unetbootin.

Booting from the USB stick (BIOS and UEFI)

  • Use the one-time boot menu (the key varies by manufacturer: F12, F11, Esc…) instead of changing the boot order.
  • If the stick shows up twice, one entry prefixed with “UEFI”, pick that one on modern machines.
  • When dual booting, install in the same mode (UEFI or legacy BIOS) as the other system.
  • Debian usually boots with Secure Boot on; only touch it if booting fails.

The installer, screen by screen

Animated illustration: Debian 13 graphical install, from the boot menu to a completed installation Animated illustration (not a real screenshot): Graphical install, language, location and keyboard, hostname debian-lab, blank root password and user “usuario”, guided partitioning with encrypted LVM, confirming the write to disk, software selection, progress, GRUB on /dev/sda, and installation complete. The real interface may use different names and positions.

The names may vary slightly in the real installer:

  1. Boot menu: choose “Graphical install”.
  2. Language: pick yours (in the illustration, Brazilian Portuguese).
  3. Location and keyboard: your country and the keyboard layout you use.
  4. Network: give the machine a name, such as debian-lab. The domain can stay blank at home.
  5. Users and passwords: the most important tip. If you leave the root password blank, the root account is disabled, the sudo package is installed, and the first user can use sudo. Then enter the full name, the username, and a strong password.
  6. Partitioning: there are three guided modes: entire disk, entire disk with LVM, and entire disk with encrypted LVM. On a laptop, choose the encrypted one: it wipes the disk and asks for a passphrase at every boot, but it protects your data if the device is lost. For beginners, use “All files in one partition”.
  7. Confirmation: the installer lists what will be formatted. From here on, the disk contents are erased.
  8. Software selection: toggle with the space bar. “Debian desktop environment” with GNOME (the default), “SSH server” if you’ll access the machine remotely, and “standard system utilities”. On a server, uncheck the desktop.
  9. Progress: the installer copies and configures the packages.
  10. GRUB: install it on the primary drive (in the example, /dev/sda).
  11. Installation complete: remove the USB stick and reboot.

Along the way you’ll also see the time zone, the package mirror (the default deb.debian.org redirects to a nearby mirror), and the package popularity survey.

First steps after installation

sudo, whoami, and hostnamectl

Open the terminal and check who you are:

whoami         # shows your user
sudo whoami    # shows root if sudo is working
groups         # the list should include "sudo"
hostnamectl    # machine name, operating system, and kernel

If you set a root password, sudo isn’t installed and your user isn’t in the group. Fix it like this, then log out and back in:

su --login          # opens a root shell
apt install sudo
adduser usuario sudo
exit

To change sudo rules, always use visudo and put local rules in /etc/sudoers.d/.

Repositories in deb822 format

In trixie, the old /etc/apt/sources.list gives way to the /etc/apt/sources.list.d/debian.sources file, in deb822 format. This is the example from the release notes:

Types: deb
URIs: https://deb.debian.org/debian
Suites: trixie trixie-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.pgp

Types: deb
URIs: https://security.debian.org/debian-security
Suites: trixie-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.pgp

main is Debian proper; only add contrib and non-free if you need them. On systems upgraded from older releases, sudo apt modernize-sources converts the .list files.

apt-get day to day

Animated illustration: updating with apt-get, installing tools, and a first edit in vim Animated illustration (not a real screenshot): sudo apt-get update, sudo apt-get upgrade -y, sudo apt-get install -y vim curl git htop, apt-cache policy vim, vim notas.txt opening in normal mode, i for INSERT mode, Esc, and :wq to save and quit (:q! quits without saving). The real interface may use different names and positions.

sudo apt-get update                          # refresh the indexes
sudo apt-get upgrade                         # upgrade without removing anything
sudo apt-get full-upgrade                    # same as dist-upgrade: may remove packages
sudo apt-get install vim curl git htop
sudo apt-get remove htop                     # remove, but keep the configuration
sudo apt-get purge htop                      # remove the configuration too
sudo apt-get autoremove                      # clean up leftover dependencies
apt-cache search '^vim'                      # search for packages
apt-cache policy vim                         # installed version, candidate, and origin

apt or apt-get?

Task apt (interactive use) apt-get / apt-cache (scripts)
Refresh indexes apt update apt-get update
Upgrade without removing apt upgrade apt-get upgrade
Upgrade, may remove apt full-upgrade apt-get full-upgrade
Search packages apt search apt-cache search
Show versions and origin apt policy apt-cache policy
Output Progress bar, may change Stable, safe for automation

At the terminal, use whichever you like. In shell scripts, prefer apt-get and apt-cache.

Automatic security updates

Security fixes arrive through the trixie-security suite. Debian’s security site recommends unattended-upgrades, which by default installs security updates only:

sudo apt install unattended-upgrades apt-listchanges
sudo dpkg-reconfigure unattended-upgrades    # answer Yes
sudo unattended-upgrade -d                   # manual run with debug output

Logs live in /var/log/unattended-upgrades/. To customize it, copy 50unattended-upgrades to /etc/apt/apt.conf.d/52unattended-upgrades-local and edit the copy. On battery power, it doesn’t run by default. Also subscribe to the debian-security-announce list to get the advisories (DSAs).

Firewall: the basics

The official sources we consulted don’t cover firewalls; what follows is general knowledge. Debian doesn’t enable firewall rules by default, and nftables is the default framework. On a lab machine, ufw keeps things simple. Allow SSH before enabling it, so you don’t lock yourself out:

sudo apt-get install -y ufw
sudo ufw allow 22/tcp
sudo ufw enable
sudo ufw status verbose

vim without fear

The modes

vim opens in Normal mode, where keys are commands. i, a, or o take you to Insert, where you type text. v enters Visual mode, for selecting. : opens the command line. Esc always takes you back to Normal.

Essential commands

Command What it does
i / a / o Insert before the cursor / after the cursor / on a new line below
Esc Back to Normal mode
:w Save
:wq or ZZ Save and quit
:q! Quit without saving
/text, n, N Search, next match, previous match
dd / yy / p Cut the line / copy the line / paste after the cursor
u / Ctrl-r Undo / redo

A minimal ~/.vimrc

" ~/.vimrc
syntax on
set number
set tabstop=4 shiftwidth=4 expandtab
set hlsearch incsearch ignorecase smartcase
set mouse=a

To turn on syntax highlighting for all users, uncomment syntax on in /etc/vim/vimrc.

vim-tiny or vim? And vimtutor

The vim-tiny package provides only basic vi. The vim package is regular vim, ideal for everyday use; there are also vim-nox (no GUI) and vim-gtk3 (with a GUI). After installing, pick the system’s default editor:

sudo apt-get install -y vim
sudo update-alternatives --config editor
vimtutor

vimtutor is an interactive tutorial. Go through it once and vim stops being scary.

Next steps

Checklist

  • I downloaded the netinst and checked the signature and sha512sum (line ending in OK)
  • I identified the USB stick with lsblk before running dd
  • I left the root password blank and confirmed sudo with sudo whoami
  • I used encrypted LVM on my laptop
  • I checked /etc/apt/sources.list.d/debian.sources and ran apt-get update and upgrade
  • I enabled unattended-upgrades for security updates
  • I finished vimtutor and created my ~/.vimrc

A well-installed Debian is a system you forget exists, until you need it.

Get updates on new posts and stay in the loop!