Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 37 ยท Getting Started

Installing a Linux Server Step by Step

Plan and perform a Linux server installation: choose installation media, verify checksums, partition, set hostname and users, enable SSH and finish with a post-install checklist.

Installing a server is less about clicking through a wizard and more about decisions made before you start: how it will be partitioned, how you will reach it, and what it must not have installed. A clean, minimal installation is easier to secure and to maintain.

Installer screens differ between distributions and versions, so this lesson describes the decisions and the checks, not the exact buttons.

Before you start

Write down the answers to these questions.

  • Role. Web server, database host, build agent, file server?
  • Hardware or virtual machine. How many CPUs, how much memory and disk?
  • Network. Static address or DHCP? Which hostname? Which DNS servers?
  • Storage layout. One big partition or separate ones for /var, /home, /tmp?
  • Access. Which user will you create, and will you use SSH keys?
  • Backups. Where will data go, and who restores it?

Getting and verifying installation media

Download the ISO from the distribution's official site. Then check it, because a corrupt or tampered image causes strange failures later. Projects publish a checksum file, usually SHA-256, and often a signature.

Terminal
sha256sum debian-netinst.iso
# compare the printed hash with the value on the project's website
sha256sum -c SHA256SUMS --ignore-missing

Write the image to a USB stick with a tool that copies raw blocks, such as dd or a graphical imager. In a virtual machine, attach the ISO as a virtual CD drive.

dd writes to whatever device you name, with no confirmation. A wrong of= target destroys that disk. Check the device with lsblk first.

Choosing a partition layout

A server benefits from keeping fast-growing directories apart so a runaway log cannot fill the root filesystem.

Mount point Why separate Typical size
/boot/efi EFI system partition for UEFI firmware 512 MB
/boot Kernels and boot files 1 GB
/ The operating system 20 to 50 GB
/var Logs, caches, databases, mail spools Large, grows
/home User files Depends
swap Overflow memory, hibernation Often 0.5 to 2 times RAM, less on large-memory hosts

For flexibility, many installers can place everything except /boot on LVM so volumes can be resized later (LVM). Disk concepts are explained in Disks and partitions.

Software selection

Choose the minimal or server profile. Add only what the role needs. Every installed package is code you must patch. A typical addition is an SSH server so you can administer the machine remotely.

Users and hostname

  • Pick a clear hostname such as web01 or db-prod-2. Avoid spaces and underscores.
  • Create a normal administrative user and give it sudo rights, rather than working as root (sudo).
  • Set a strong password or, better, install an SSH public key and later disable password logins.

After the first boot: checklist

Terminal
hostnamectl                  # confirm the name
ip addr                      # confirm the address
sudo apt update && sudo apt upgrade -y     # Debian family
sudo dnf upgrade -y                        # Red Hat family
timedatectl                  # time zone and NTP
sudo systemctl status ssh    # on Red Hat: sshd

Then enable automatic security updates, set up a firewall, create a snapshot or backup of the clean state and record the configuration in your notes.

flowchart LR
    A["Verify ISO"] --> B["Boot installer"]
    B --> C["Partition"]
    C --> D["Users + hostname"]
    D --> E["Minimal packages"]
    E --> F["First boot checks"]
    F --> G["Updates + firewall + backup"]

From download to a ready server.

A stand-in: planning partition sizes

Sizing is arithmetic. This model splits a disk using fixed sizes and gives the remainder to /var, then warns if anything is too small. It runs in your browser; it does not touch a disk.

Python Stand-in: partition plan calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A stand-in: verifying a checksum

The idea behind sha256sum is that the same bytes always give the same hash and any change gives a different one. Python's hashlib can show it with text instead of an ISO.

Python Stand-in: checksums detect changes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Installing every package group "just in case".
  • Using the whole disk for one partition on a server whose logs will grow.
  • Forgetting to set the time zone or NTP, which confuses logs and certificates.
  • Not recording the root or recovery information anywhere.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why verify the checksum of an ISO?

    A different hash means different bytes than the publisher released.
  2. 2. Why is /var often a separate partition on servers?

    Separating fast-growing data protects the operating system.
  3. 3. What is a safer way to work than logging in as root daily?

    sudo grants elevated rights only for specific commands and logs their use.
  4. 4. Which install profile reduces what you must patch?

    Fewer packages means a smaller attack surface and less maintenance.

Summary

  • Decide role, network, storage and access before installing.
  • Verify the ISO, choose a sensible partition layout, keep the install minimal.
  • Create a normal user with sudo and prefer SSH keys.
  • After first boot: update, check time, firewall, backup.

Next: First Login and Shell Basics for Admins