Thursday, September 10, 2026

How to Install Docker Engine on Ubuntu: Step-by-Step Guide

 


Docker has become one of the most important tools in modern software development, DevOps, cloud engineering, and system administration.

Whether you are building microservices, running databases, deploying web applications, experimenting with Kubernetes, or setting up an AI development environment, Docker provides a consistent way to package and run applications.

In this guide, we'll install Docker Engine on Ubuntu using Docker's official APT repository.

The process is straightforward and works well for developers, DevOps engineers, SREs, system administrators, and anyone learning containerization.


🐳 What Is Docker?

Docker is a containerization platform that allows applications and their dependencies to run inside isolated environments called containers.

Instead of installing every application dependency directly onto your Ubuntu system, you can package an application into a container and run it consistently across different environments.

A typical Docker workflow looks like this:

Application
     ↓
Dockerfile
     ↓
Docker Image
     ↓
Docker Container
     ↓
Application Running

For example, instead of installing a database directly on Ubuntu, you could run PostgreSQL inside a Docker container.


🧩 Prerequisites

Before installing Docker, make sure you have:

  • An Ubuntu system
  • Internet connectivity
  • A user with sudo privileges
  • A terminal
  • Basic familiarity with Linux commands

It is also a good idea to update your system before starting.


🚀 Step 1: Update Ubuntu

Open Terminal:

Ctrl + Alt + T

Then run:

sudo apt update && sudo apt upgrade -y

This updates the package index and installs available package upgrades.

Depending on how recently your system was updated, this may take a few minutes.


📦 Step 2: Install Required Dependencies

Docker's repository setup requires several supporting packages.

Install them with:

sudo apt install -y ca-certificates curl gnupg lsb-release

These packages provide tools required to securely access and configure external APT repositories.


🔐 Step 3: Add Docker's Official GPG Key

Create the directory used to store APT repository keys:

sudo mkdir -p /etc/apt/keyrings

Now download Docker's official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

The key allows APT to verify packages obtained from Docker's repository.


🗂️ Step 4: Add the Docker APT Repository

Next, configure Ubuntu to use Docker's official package repository:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

This command dynamically detects:

  • Your CPU architecture
  • Your Ubuntu release codename
  • Docker's stable repository

The repository configuration is written to:

/etc/apt/sources.list.d/docker.list

🔄 Step 5: Update the Package Index

How to Disable Sleep When You Close the Laptop Lid in Ubuntu

Have you ever connected your Ubuntu laptop to an external monitor, SSH session, server, or other device and discovered that everything stops working as soon as you close the laptop lid?

By default, Ubuntu may suspend the system when the laptop lid is closed. This is useful for normal laptop use because it saves battery and reduces power consumption. However, it can be inconvenient when you want your laptop to continue running with the lid closed.

For example, you may want to use your Ubuntu laptop as:

  • A home server
  • An SSH server
  • A development machine
  • A media server
  • A Docker/Kubernetes node
  • A machine connected to an external monitor
  • A remote desktop system
  • A background download or automation system

Fortunately, Ubuntu allows you to change the lid-close behavior through systemd-logind.


What Happens When You Close the Laptop Lid?

On a typical Ubuntu installation, closing the lid triggers an action handled by systemd-logind.

The default behavior is commonly:

HandleLidSwitch=suspend

This means:

When the laptop lid is closed, suspend the system.

We can change this behavior to:

HandleLidSwitch=ignore

This tells Ubuntu:

When the lid is closed, do nothing.

The laptop will therefore continue running even though the physical lid is closed.


Method: Disable Suspend on Lid Close

Step 1: Open the Terminal

Press:

Ctrl + Alt + T

Alternatively, search for Terminal from the Ubuntu application menu.


Step 2: Open the systemd Login Configuration

Run:

sudo nano /etc/systemd/logind.conf

You will be asked for your administrator password.

The file contains configuration options controlling various login and power-management behaviors.


Step 3: Find the Lid Switch Setting

Look for:

#HandleLidSwitch=suspend

The # means that the line is commented out.

Change it to:

HandleLidSwitch=ignore

If the line already exists without #, simply change:

HandleLidSwitch=suspend

to:

HandleLidSwitch=ignore

Your configuration should look like:

[Login]
HandleLidSwitch=ignore

If [Login] already exists, don't create another [Login] section.


What About External Power?

If you primarily use your laptop while it is connected to a charger, you can also configure the external-power behavior:

HandleLidSwitchExternalPower=ignore

This can be useful when the laptop is being used as a workstation or server while connected to AC power.

For example:

[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore

What About a Dock or Docking Station?

If you use your Ubuntu laptop with a docking station, you may also encounter the docked-state setting.

You can configure:

HandleLidSwitchDocked=ignore

A configuration for a laptop that should remain running regardless of lid/power state could therefore be:

[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

However, you don't necessarily need all three settings. Start with HandleLidSwitch=ignore and add the others only if your particular setup requires them.


Step 4: Save the Configuration

If you're using Nano:

  1. Press Ctrl + X
  2. Press Y to confirm saving
  3. Press Enter

Your configuration has now been saved.


Step 5: Apply the Changes

You can restart systemd-logind:

sudo systemctl restart systemd-logind

Alternatively, and often more conveniently on a desktop/laptop system, reboot Ubuntu:

sudo reboot

A reboot ensures that the new configuration is loaded cleanly.

Important: Restarting systemd-logind can affect active graphical/login sessions on some systems. If this is an important workstation or remote machine, a planned reboot may be the safer option.


Test the Configuration

After Ubuntu starts again, close the laptop lid.

If everything is configured correctly, Ubuntu should remain running instead of suspending.

You can test this by:

  • Connecting through SSH
  • Checking a running process
  • Accessing a web server
  • Connecting through Remote Desktop
  • Monitoring a Docker container
  • Checking a file transfer
  • Accessing an external monitor

For example, from another computer:

ssh username@ubuntu-ip

If the connection continues working after closing the lid, your Ubuntu machine is successfully remaining active.


Useful Configuration Examples

Normal Laptop — Suspend on Lid Close

The default behavior can be represented by:

HandleLidSwitch=suspend

This is appropriate if you want the laptop to save power when you close the lid.


Laptop Server — Keep Running

For a laptop being used as a server:

HandleLidSwitch=ignore

This prevents lid closure from triggering suspend.


Laptop Used as a Docked Workstation

If you frequently connect the laptop to a charger, monitor and dock:

HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

Why Would You Want to Disable Lid Sleep?

There are several practical situations where this configuration is useful.

1. Using an External Monitor

You may want to close the laptop lid and use only your external display.

Without changing the lid behavior, Ubuntu may suspend the laptop.

2. Running a Home Server

An old laptop can make an excellent low-power home server.

You could run:

  • Ubuntu Server
  • Docker
  • Kubernetes
  • PostgreSQL
  • Web applications
  • File servers
  • Home automation
  • Media services

Disabling lid suspension allows the laptop to continue operating with the lid closed.

3. Remote Access

If you use:

  • SSH
  • RDP
  • VNC
  • RustDesk
  • Other remote-management tools

you may want the machine to remain available even when the lid is closed.

4. Long-Running Jobs

Developers and administrators may run:

Docker containers
Build jobs
Data-processing tasks
Machine-learning workloads

or other long-running processes.

Suspending the laptop could interrupt or pause these workloads.


Check Whether the Configuration Is Active

You can inspect the current configuration with:

grep -i "HandleLidSwitch" /etc/systemd/logind.conf

You may see:

HandleLidSwitch=ignore

You can also inspect the effective logind configuration:

loginctl show-logind

On systems where the command exposes the relevant properties, look for values such as:

HandleLidSwitch=ignore

Important: Disabling Sleep Is Not the Same as Disabling the Screen

Changing:

HandleLidSwitch=ignore

doesn't necessarily mean that the display will remain active.

The laptop can continue running while its internal display is turned off because the lid is closed.

This is generally desirable when using the machine as a server or with an external monitor.


Important Power and Heat Considerations

Keeping a laptop running with the lid closed isn't always ideal.

The display may turn off, but the CPU, storage, networking hardware and other components can continue operating.

On some laptop designs, closing the lid can also reduce airflow around the keyboard or cooling system.

Therefore:

Make sure the laptop has adequate ventilation.

Avoid placing a running laptop:

  • Inside a closed cabinet
  • Under blankets
  • On a soft bed
  • In an area where air vents are blocked

If you're converting an old laptop into a permanent server, consider placing it on a hard, well-ventilated surface.


What If It Still Suspends?

If changing logind.conf doesn't work, don't immediately assume the configuration is wrong.

Several factors can influence power management, including:

  • Desktop-environment settings
  • GNOME power-management behavior
  • Docking state
  • External power configuration
  • systemd-logind inhibitors
  • Distribution-specific configuration
  • Other power-management software

First verify your configuration:

grep -i "HandleLidSwitch" /etc/systemd/logind.conf

Then reboot and test again.

You can also check the system journal:

journalctl -u systemd-logind

This can help identify whether systemd-logind is processing the lid event.


Is It Safe to Disable Lid Suspend?

Generally, yes, if you understand the consequences.

The configuration does not disable the laptop's ability to suspend manually. It changes what happens specifically when the lid is closed.

You should, however, consider:

  • Battery consumption
  • Heat generation
  • Ventilation
  • Accidental overheating
  • Whether the laptop is connected to AC power
  • Whether you actually need the machine running continuously

For a laptop being used as a home server, keeping it connected to AC power and ensuring good ventilation is usually more appropriate than relying on battery power.


Quick Command Summary

Edit the configuration

sudo nano /etc/systemd/logind.conf

Set lid close to do nothing

HandleLidSwitch=ignore

Optional external-power setting

HandleLidSwitchExternalPower=ignore

Optional docked setting

HandleLidSwitchDocked=ignore

Restart logind

sudo systemctl restart systemd-logind

Or reboot

sudo reboot

Check your configuration

grep -i "HandleLidSwitch" /etc/systemd/logind.conf

Final Thoughts

Ubuntu is flexible enough to turn an ordinary laptop into a surprisingly capable server or always-on Linux workstation.

If you frequently use your Ubuntu laptop with an external monitor, SSH, Remote Desktop, Docker, Kubernetes or other long-running services, changing the lid-close action from:

suspend

to:

ignore

can make the machine much more convenient to operate.

The key configuration is simply:

HandleLidSwitch=ignore

Just remember that "ignore" means Ubuntu will not automatically suspend because you closed the lid. It does not mean the machine consumes no power or generates no heat.

For a server-style setup, always prioritize proper ventilation, reliable power and appropriate security.

One-Line Takeaway

Want your Ubuntu laptop to keep running after you close the lid? Set HandleLidSwitch=ignore in /etc/systemd/logind.conf, then reboot and test it.


Tags:

Ubuntu, Ubuntu Linux, Ubuntu Tutorial, Linux Tutorial, Linux Tips, Ubuntu Tips, Laptop Lid Close, Disable Sleep Ubuntu, Disable Suspend Ubuntu, Ubuntu Lid Settings, systemd logind, systemd-logind, logind.conf, Linux Power Management, Ubuntu Power Management, External Monitor Ubuntu, Ubuntu Server, Laptop as Server, SSH Server Ubuntu, Remote Desktop Ubuntu, Linux Server, Ubuntu 24.04, Ubuntu 25.04, Ubuntu 26.04

Hashtags:

#Ubuntu, #UbuntuLinux, #Linux, #LinuxTips, #UbuntuTips, #UbuntuTutorial, #LinuxTutorial, #LinuxServer, #UbuntuServer, #Systemd, #SystemdLogind, #LinuxPowerManagement, #DisableSleep, #DisableSuspend, #LaptopServer, #RemoteDesktop, #LinuxAdmin, #DevOps, #SRE, #OpenSource 

Wednesday, September 9, 2026

Ubuntu 26.04 LTS: Setting Up Native RDP Remote Login from Windows — A Real-World Troubleshooting Guide

Table of Contents

  • Why use native GNOME RDP?
  • Remote Login vs Desktop Sharing
  • Check Ubuntu version
  • Enable system RDP
  • Configure TLS
  • Configure RDP credentials
  • Configure GDM
  • Check port 3389
  • Test from Windows
  • Diagnose RDP failures
  • Final architecture

Ubuntu 26.04 LTS and Native RDP

Ubuntu 26.04 LTS uses the modern GNOME desktop stack and provides GNOME Remote Desktop for remote desktop access.

This means you can connect to an Ubuntu machine from Windows using Microsoft's built-in Remote Desktop Connection application instead of immediately installing third-party RDP software.

Recommended approach: For a modern Ubuntu 26.04 workstation or headless AI server, start with GNOME's native Remote Login functionality before installing xrdp.

The Goal

┌──────────────────────────┐
│ Windows 11 PC            │
│                          │
│ mstsc.exe                │
└────────────┬─────────────┘
             │
             │ RDP / TCP 3389
             │
             ▼
┌──────────────────────────────┐
│ Ubuntu 26.04 LTS             │
│                              │
│ GNOME Remote Desktop         │
│             ↓                │
│ GDM / GNOME Login            │
│             ↓                │
│ Ubuntu Desktop               │
└──────────────────────────────┘

Remote Login vs Desktop Sharing

Tuesday, September 8, 2026

🚀 The Ultimate Guide to Running Local LLMs on Any PC

A Practical, Step-by-Step Guide to Running AI Models Locally


📖 Introduction

What Are Large Language Models (LLMs)?

Large Language Models are AI systems trained on vast amounts of text data to understand, generate, and manipulate human language. Think of them as incredibly advanced text prediction engines that can write essays, answer questions, write code, and even engage in creative writing.

Why Run LLMs Locally?

In recent years, cloud-based AI assistants like ChatGPT, Claude, and Gemini have become incredibly popular. However, running models on your own computer offers significant advantages:

BenefitDescription
🔒 Complete PrivacyYour data never leaves your machine – perfect for sensitive documents, medical information, or proprietary code
🌐 Offline AccessWork anywhere without internet connectivity – great for travel, remote locations, or secure environments
💰 No Subscription FeesOne-time setup, forever free – no monthly subscriptions or per-request charges
🎨 Full CustomizationYou control everything – model choice, system prompts, parameters, and fine-tuning
🚫 No Content FiltersUnrestricted access – useful for research, creative writing, and uncensored exploration
📈 Learning OpportunityUnderstand how AI works under the hood – invaluable for developers and AI enthusiasts

Who Is This Guide For?

This comprehensive guide is designed for:

  • 👨‍💻 Developers wanting to integrate AI into their applications without cloud costs

  • 🔬 Researchers who need complete control over their AI environment

  • ✍️ Writers and Creators seeking privacy for their work

  • 🎓 Students learning about machine learning and AI

  • 🏢 Businesses with data privacy requirements

  • 🤖 AI Enthusiasts wanting to explore state-of-the-art models


💻 System Requirements

Hardware Requirements

Before diving in, let's check if your hardware is ready. Here's what you need:

Minimum Requirements (Will Run Small Models)

ComponentSpecification
RAM8 GB
Storage20 GB free (SSD recommended)
CPU4+ cores, 2.0 GHz+
GPUOptional (CPU-only is fine for small models)
OSWindows 10+, macOS 12+, or Linux (Ubuntu 20.04+)

Recommended Requirements (Good Performance)

ComponentSpecification
RAM16 GB
Storage50 GB free (NVMe SSD recommended)
CPU8+ cores, 3.0 GHz+
GPUNVIDIA 6GB+ VRAM (RTX 3060/4060 minimum) or AMD with ROCm support
OSWindows 11, macOS 14+, or Linux (Ubuntu 22.04)

Optimal Requirements (Best Experience)

ComponentSpecification
RAM32-64 GB
Storage200+ GB free (NVMe SSD)
CPU12+ cores, 3.5 GHz+ (e.g., Ryzen 9, Intel i9)
GPUNVIDIA 12GB+ VRAM (RTX 3090/4090) or equivalent
OSWindows 11 Pro, macOS 15+, or Linux (Ubuntu 22.04+)

How to Check Your System

Windows:

powershell
# Check RAM and CPU
wmic memorychip get capacity
wmic cpu get name,numberofcores

# Check GPU
wmic path win32_VideoController get name,adapterram

# Check Storage
wmic logicaldisk get size,freespace,caption

macOS:

bash
# System info
system_profiler SPHardwareDataType

# GPU info
system_profiler SPDisplaysDataType

# Storage info
df -h

Linux:

bash
# CPU and RAM
lscpu
free -h

# GPU (NVIDIA)
nvidia-smi

# GPU (AMD)
rocm-smi

# Storage
df -h

🛠️ Preparation

Installing Python and Package Managers

Python is essential for most LLM tools. Here's how to set it up:

Windows

powershell
# Download Python from python.org
# Or use winget (Package Manager)
winget install Python.Python.3.11

# Verify installation
python --version

macOS

bash
# Using Homebrew (recommended)
brew install python@3.11

# Or download from python.org

# Verify
python3 --version

Linux (Ubuntu/Debian)

bash
# Install Python
sudo apt update
sudo apt install python3.11 python3-pip python3-venv

# Verify
python3 --version

Setting Up Virtual Environments

Virtual environments isolate your Python packages – crucial for avoiding conflicts.

Create Virtual Environment

bash
# Create venv
python -m venv llm_env

# Activate on Windows
llm_env\Scripts\activate

# Activate on macOS/Linux
source llm_env/bin/activate

# Upgrade pip
pip install --upgrade pip

GPU Drivers and Dependencies

Featured Posts

How to Install Docker Engine on Ubuntu: Step-by-Step Guide

  Docker has become one of the most important tools in modern software development, DevOps, cloud engineering, and system administration. Wh...