How to Install Ubuntu Server: Step-by-step
Linux & Sistemas · By Kevin Marcondes · Published on · Updated on · 8 min read
This guide walks you through installing Ubuntu Server: preparing a USB stick, booting from it, choosing partitioning, configuring network settings, and performing secure post-installation. It’s a direct, practical walkthrough with ready-to-run commands so you can verify each step and avoid common pitfalls.
Prerequisites and ISO download
You need a 64-bit compatible computer, a USB stick (8 GB or larger), and the Ubuntu Server ISO image. Back up any data on the machine that will receive the installation.
Download the LTS edition from the official site. It receives updates for several years and is usually the most stable choice for servers.
Verify the ISO integrity using the checksum. Installing from a corrupted ISO can fail partway through the process.
- CPU and RAM: more resources improve performance for your workloads.
- A USB 3.0 stick speeds up writing the ISO.
- An internet connection during install makes it easier to fetch packages.
- Back up the target disk: the installer will erase it.
# Linux/macOS: verificar checksum SHA256
echo "<SHA256_ESPERADO> ubuntu-XX.XX-live-server-amd64.iso" | sha256sum -c -
# ou
sha256sum ubuntu-XX.XX-live-server-amd64.iso
# Windows PowerShell: verificar SHA256
Get-FileHash .\ubuntu-XX.XX-live-server-amd64.iso -Algorithm SHA256
Create a bootable USB (Windows, macOS and Linux)
On Windows, use a graphical tool like Rufus or balenaEtcher to write the ISO to the USB stick. On macOS and Linux you can use dd from the terminal.
Warning: dd will completely erase the USB stick. Verify the target device before running it. After writing, eject the device safely.
If you plan to run containers or virtualization on the server, study isolation and HA differences. Consider the trade-offs before choosing.
- On Windows: choose the ISO and the USB stick and write in the recommended mode.
- On macOS: identify the disk with diskutil and use rdisk for better speed.
- On Linux: find the device with lsblk and write the ISO with dd.
# macOS: identificar e gravar (ajuste /dev/disk2)
diskutil list
diskutil unmountDisk /dev/disk2
sudo dd if=ubuntu-XX.XX-live-server-amd64.iso of=/dev/rdisk2 bs=4m conv=sync status=progress
sync
# Linux: identificar e gravar (ajuste /dev/sdX)
lsblk
sudo dd if=ubuntu-XX.XX-live-server-amd64.iso of=/dev/sdX bs=4M conv=fsync status=progress
sync
Boot from USB and installer initial options
Plug the USB stick in and use the boot menu (usually F12, F10 or Esc at power on). Choose to boot from the USB device.
Prefer UEFI if the hardware supports both UEFI and Legacy/CSM. UEFI provides better security features and works well with GPT disks.
In the installer, select language, keyboard layout, network (DHCP works for most setups) and time zone. These options can be changed later.
If the installer offers to update itself before continuing, accept — it can avoid bugs that were already fixed.
Disk partitioning: guided or manual
The installer provides guided and manual modes. If you don’t need a custom layout, the guided mode is faster and less error-prone.
For servers, LVM and disk encryption are common choices. LVM makes volume expansion easier. LUKS protects data at rest. Any choice will erase the target disk.
| Option | When to use | Pros | Cons |
|---|---|---|---|
| Use entire disk (guided) | Quick install on a dedicated disk | Simplicity, fewer mistakes | Less control over layout |
| LVM (logical volumes) | When you need flexible partition sizes | Resizing and snapshots | More complex than simple partitions |
| LUKS encryption | Sensitive data at rest | Protects data if device is lost/stolen | Requires a passphrase at boot, small performance impact |
| Manual (custom) | Specific requirements for /, /var, /home | Full control over layout | More steps and higher chance of mistakes |
| ZFS (when available) | Need features like snapshots/compression | Advanced filesystem features | Higher RAM usage and learning curve |
Configure network and hostname
If DHCP works for you, stick with it and adjust later. For a static IP, configure Netplan. When using a static address, reserve it on the router or ensure there’s no conflict.
Set a simple, descriptive hostname like srv-web-01. That helps when reading logs and monitoring systems.
Exposing APIs or public services? Strengthen authentication and rate limits before going live.
- DHCP: quick and zero friction.
- Static IPv4: predictable addresses for DNS and port forwarding.
- Public DNS: use A/AAAA and PTR records if needed.
# /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.1.50/24]
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [1.1.1.1,8.8.8.8]
# Aplicar as alterações
sudo netplan apply
User, SSH and basic firewall
Create an administrative user and configure SSH. Enable the UFW firewall to expose only required services. If you disable password auth in SSH, be sure your public key is already in authorized_keys.
To increase security, disable root login over SSH and, if possible, disable password authentication.
- Use a regular user and add it to the sudo group.
- Open only the OpenSSH port.
- Log access attempts for auditing.
# Criar usuário e dar privilégios
sudo adduser admin
sudo usermod -aG sudo admin
# Instalar e habilitar o servidor SSH (se necessário)
sudo apt update && sudo apt install -y openssh-server
sudo systemctl enable --now ssh
# Endurecer SSH (opcional): desativar root e senha
sudo bash -c 'cat > /etc/ssh/sshd_config.d/hardening.conf <<EOF
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
EOF'
sudo systemctl reload ssh
# Firewall básico com UFW
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose
Post-installation: updates and useful utilities
Keep the system updated and automate security updates. Install tools that help with daily operations.
Sync time with NTP and set the correct time zone so logs and scheduled tasks make sense.
Thinking about observability and resilience from day one? Use monitoring and backup practices early on.
- Enable automatic security updates.
- Use Fail2ban to block brute-force attempts.
- Useful tools: htop, curl, git, unzip, tar.
# Atualizações e utilitários
sudo apt update && sudo apt -y upgrade
sudo apt install -y unattended-upgrades fail2ban htop curl git unzip tar
# Habilitar serviços importantes
sudo systemctl enable --now unattended-upgrades
sudo systemctl enable --now fail2ban
# Fuso horário e NTP (ajuste a zona)
sudo timedatectl set-timezone America/Sao_Paulo
sudo timedatectl set-ntp true
timedatectl status
How to confirm it worked and troubleshooting
Verify the OS version, network, SSH and firewall. If something fails, check the common causes listed below and inspect installer/system logs for clues.
Common issues: USB that won’t boot, network without IP, GRUB errors, and SSH access blocked. Review the installer output and system logs to find hints.
If you’ll run production services, set up deployment processes and monitor critical events from the start.
- USB won’t boot: rewrite the ISO and try a different port/cable. In UEFI, disable Secure Boot if needed.
- No network: check Netplan (nameservers and gateway) and apply with netplan apply.
- GRUB error: ensure UEFI matches the GPT partition table and boot device.
- SSH denied: if you disabled password auth, verify the user’s authorized_keys and UFW ports.
- Inconsistent DNS: fix hostname and /etc/hosts, clear caches with systemd-resolve --flush-caches.
# Versão do Ubuntu e kernel
cat /etc/os-release | grep PRETTY_NAME
uname -r
# Rede e DNS
ip -4 addr show
ip route
resolvectl status | sed -n '1,20p'
# SSH e firewall
systemctl status --no-pager ssh
sudo ufw status numbered
Frequently asked questions
Which Ubuntu Server edition should I choose: LTS or non-LTS?
For servers, prefer LTS. It gets support and fixes for several years and reduces the number of version upgrades. Non-LTS releases bring newer features sooner but require more frequent updates. In production, stability is usually the priority.
What are the minimum requirements to install Ubuntu Server?
It runs on 64-bit processors with modest resources, but experience depends on workload. For basic services, 2 GB of RAM is possible. Databases and applications need more CPU, RAM and fast storage. Plan according to expected use.
Do I have to use LVM and encryption?
No. LVM makes it easier to grow volumes without reinstalling. LUKS encryption protects data at rest and is useful when there is physical risk. If you want maximum simplicity, the guided partition without LVM is fine. If you need flexibility, consider LVM.
How do I set a static IP after installation?
Edit a YAML file in /etc/netplan/ with the address, gateway and DNS, then apply it with netplan apply. Make sure the IP won’t conflict with your router’s DHCP. Keeping a record of reserved IPs reduces surprises.
How do I enable secure remote access via SSH?
Install openssh-server, create a non-root user and add it to sudo. In SSH config, disable root login and password authentication if you use keys. Restrict access with UFW and test access from another session before closing the current one to avoid locking yourself out.
Can I install using network-only (netboot)?
Network-based installs are possible but require extra infrastructure, such as a server providing images. For most cases, creating a bootable USB from the ISO is simpler and more reliable.
Got questions during the installation?
You can return to this guide anytime and suggest improvements or topics for future tutorials.
Suggest a topicSee also
- Tutorial: Implement Canary releases with Traefik in Docker Compose using headers and weighted routing for gradual PHP deployments
- Tutorial: Configure HAProxy with Let's Encrypt and health checks to load balance traffic between Docker containers on a VPS (step-by-step)
- Hands‑On Tutorial: Implement mTLS Between Nginx and Microservices with smallstep CA in Docker Compose
- Tutorial: configure cgroup v2 and systemd ResourceControl to limit CPU, memory and I/O for Docker containers on Debian