How To Setup Ubuntu Server

How To Setup Ubuntu Server

Reading time1 min
#Ubuntu#Server#Linux#Minimalism#Sysadmin#Security

Mastering Minimalist Ubuntu Server Setup for Maximum Efficiency

Forget bloated server setups. Discover how a minimalist Ubuntu server configuration not only accelerates deployment but also fortifies your environment against common vulnerabilities, setting a new standard for efficient server management.


When managing servers, less is more. A lean Ubuntu server setup strips away unnecessary components, enhancing performance and security while reducing maintenance overhead — crucial for admins aiming for robust, reliable infrastructure. In this post, I’ll walk you through how to set up a minimalist Ubuntu server from scratch, focusing strictly on essentials to maximize efficiency.


Why Go Minimalist?

Before diving into the “how,” let’s quickly touch on why minimalism matters:

  • Improved Performance: Fewer services and packages mean less CPU and memory consumption.
  • Enhanced Security: Less software footprint means fewer attack vectors.
  • Simpler Maintenance: No bloat translates into fewer updates and reduced complexity.
  • Faster Boot Times & Deployments: With minimal packages, your server boots quickly and can be deployed consistently.

Step 1: Choose the Right Ubuntu Flavor

Start with the official Ubuntu Server LTS (Long Term Support) edition. If you want extreme minimalism, consider the likes of:

  • Ubuntu Server Minimal ISO: A stripped-down installer with basic command-line utilities only.
  • Or use the normal Ubuntu Server ISO and opt-out of optional package installation when prompted.

For this guide, I will be using Ubuntu Server 22.04 LTS Minimal Install (you can select "Minimal Installation" during setup).


Step 2: Perform a Minimal Installation

  1. Boot from the Ubuntu Server ISO and proceed to installation.
  2. During the software selection step (tasksel), do not select any “standard system utilities” or additional packages like OpenSSH yet.
  3. Complete installation with just the base system.

Why? Because we want full control over what’s installed — no unnecessary daemons or services running by default.


Step 3: Initial System Update & User Setup

Once installed and booted, first things first:

sudo apt update && sudo apt upgrade -y

Create an administrative user (skip if you set one up during install):

sudo adduser deployer
sudo usermod -aG sudo deployer

Always log in as this non-root user and elevate privileges with sudo when needed — better security practice.


Step 4: Install Only Essential Packages

At this point, your server might be too barebones since you skipped installing OpenSSH during setup (recommended). Let's install it now:

sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh

Next, consider what essentials you need for your specific use cases:

  • For shell utilities: vim or nano, curl, wget
  • For firewall management: ufw
  • For networking diagnostics: net-tools or iproute2 (usually pre-installed)

Install these on demand:

sudo apt install vim curl ufw -y

If running containers or virtualization is part of your architecture, add those tools only once you intend to use them.


Step 5: Harden Your Minimal Server

Minimalism also directly supports security by default:

Disable Unused Services

Check running services:

systemctl list-units --type=service --state=running

Disable anything unnecessary:

sudo systemctl disable some-service.service

Configure UFW Firewall

Enable UFW to allow SSH and block everything else by default:

sudo ufw default deny incoming
sudo ufw default allow outgoing

# Allow SSH on default port 22:
sudo ufw allow ssh

# Enable firewall:
sudo ufw enable

Secure SSH Access

Edit /etc/ssh/sshd_config to improve security:

  • Change default port (Port 2222).
  • Disable root login (PermitRootLogin no).
  • Use key-based authentication only (PasswordAuthentication no).

After changes:

sudo systemctl restart sshd

Example snippet added to /etc/ssh/sshd_config:

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes

Ensure you've added your public keys beforehand.


Step 6: Keep It Lean During Upgrades

Avoid installing "Recommended" or "Suggested" packages unless absolutely necessary by appending flags in apt commands:

sudo apt install --no-install-recommends package-name

Also consider unattended upgrades configured minimally:

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

Configure /etc/apt/apt.conf.d/50unattended-upgrades carefully to upgrade security patches only.


Step 7: Monitoring a Minimal System

To stay efficient and informed without adding heavy monitoring suites:

  • Use simple tools like htop, iotop, and journalctl built into the server.

Install just if needed:

sudo apt install htop -y 

For systematic logging, keep logs concise (rotate frequently) and monitor /var/log.


Bonus Tip: Automate Your Minimal Server Build

If you frequently set up servers, write a simple shell script that automates installing only the packages and settings you want. For example:

#!/bin/bash

apt update && apt upgrade -y

apt install --no-install-recommends openssh-server ufw vim curl -y

systemctl enable ssh ufw 
systemctl start ssh ufw 

ufw default deny incoming 
ufw default allow outgoing 
ufw allow 2222/tcp   # custom ssh port 
ufw enable 

sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config 
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config 
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config 

systemctl restart sshd 

echo "Minimal Ubuntu server setup complete."

Run this on a freshly installed box to get a secure, minimal environment quickly.


Conclusion

A minimalist Ubuntu server setup isn’t just about saving space—it’s about creating a foundation that is fast, secure, easier to manage, and reliable over time. By installing only what you need, locking down access rigorously, and avoiding bloat at every step, you engineer an environment built for sustainable success.

Start minimal today — your future self will thank you!


Have questions or want me to cover specific server setups? Drop a comment below!