Ubuntu 22.04 LTS Home Server Setup Guide


🎯 Target Architecture

This configuration ensures:

  • HDMI output available for local GUI access (GNOME session)

  • Fully operational in headless mode (no monitor attached)

  • SSH as primary remote management interface

  • Stable RDP access even without physical display

  • Docker services auto-start on boot

  • System runs 24/7 without suspend or power-saving interruptions

1️⃣ System Verification

Verify Ubuntu Version

lsb_release -a

Expected output:

Ubuntu 22.04.x LTS

Verify System Memory

free -h

Recommended:

RAM    Recommendation
≥ 8GB    GNOME + XFCE supported
4GB    Consider removing GNOME
< 4GB    Use Ubuntu Server instead of Desktop

2️⃣ Docker Installation (If Not Installed)

sudo apt update
sudo apt install docker.io -y
sudo systemctl enable docker
sudo systemctl start docker

Add current user to Docker group:

sudo usermod -aG docker $USER

Log out and log back in for changes to apply.

3️⃣ SSH Setup (Primary Management Channel)

Verify SSH Service

systemctl status ssh

Install if Missing

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

Recommended: SSH Key-Based Authentication

On local machine:

ssh-keygen
ssh-copy-id user@server-ip

Disable password authentication:

sudo nano /etc/ssh/sshd_config

Set:

PasswordAuthentication no

Restart SSH:

sudo systemctl restart ssh

4️⃣ Headless RDP Configuration (Stable Setup)

Ubuntu 22.04 Desktop includes GNOME Remote Desktop by default, which conflicts with xRDP on port 3389.

Step 1: Install xRDP

sudo apt install xrdp xorgxrdp -y
sudo systemctl enable xrdp

Step 2: Disable GNOME Remote Desktop (Port Conflict Prevention)

sudo systemctl disable gnome-remote-desktop.service
sudo systemctl stop gnome-remote-desktop.service

Verify port availability:

sudo ss -tulpn | grep 3389

Port 3389 must be free before starting xRDP.

Step 3: Install Lightweight Desktop Environment (XFCE)

XFCE is recommended for headless RDP sessions due to lower memory footprint and Xorg compatibility.

sudo apt install xfce4 xfce4-goodies -y

Configure xRDP session to use XFCE:

echo "startxfce4" > ~/.xsession

Step 4: Start xRDP Service

sudo systemctl start xrdp
systemctl status xrdp

Expected:

Active: active (running)

5️⃣ Headless Operation Configuration

Prevent system suspension and power-saving interruptions.

Disable System Sleep Targets

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Disable Automatic Suspend

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'

Disable Screen Blank

gsettings set org.gnome.desktop.session idle-delay 0

Recommended Hardware Enhancement

If the system fails to create a display session when HDMI is disconnected:

Use an HDMI dummy plug.

This emulates a physical display and guarantees stable graphical session initialization.

6️⃣ Firewall Configuration (If UFW Enabled)

sudo ufw allow 22
sudo ufw allow 3389
sudo ufw enable
sudo ufw status

7️⃣ Brute-Force Protection (Fail2ban)

sudo apt install fail2ban -y
sudo systemctl enable fail2ban

8️⃣ Operational Workflow

Scenario    Recommended Access Method
Routine administration    SSH
Remote GUI access    RDP (XFCE session)
Local physical access    GNOME via HDMI
Background services    Docker

9️⃣ Common Issues & Troubleshooting

xRDP Fails: Address Already in Use

Cause: Port 3389 conflict (usually GNOME Remote Desktop)

Check:

sudo ss -tulpn | grep 3389

Black Screen After RDP Login

Possible causes:

  • xorgxrdp not installed

  • ~/.xsession not configured

  • Wayland enabled

Disable Wayland:

sudo nano /etc/gdm3/custom.conf

Uncomment:

WaylandEnable=false

Reboot system.

🔟 Final System Architecture

Ubuntu 22.04 Desktop

├── GNOME → Local HDMI session
├── XFCE → Remote RDP session
├── SSH → Primary management interface
├── Docker → Service runtime environment
└── Sleep disabled → 24/7 operation

✅ Production-Ready Checklist

✔ Ubuntu Desktop 22.04 LTS
✔ Docker auto-start enabled
✔ SSH key authentication
✔ xRDP configured
✔ XFCE installed for RDP
✔ GNOME retained for local HDMI
✔ Sleep disabled
✔ GNOME Remote Desktop disabled
✔ Fail2ban enabled
✔ (Recommended) HDMI dummy plug

This document was compiled with the assistance of ChatGPT.

About the author

Hieu Le
A cozy little corner to share what I’ve learned and to keep memories that make the journey worthwhile.

Post a Comment