Resource constraints on older hardware or virtual machines can cause Ubuntu systems to freeze, slow down, or run out of memory during regular use. Opting for Ubuntu’s minimal install options and refining your desktop environment directly addresses these issues, cutting down on unnecessary background services and applications that consume RAM and disk space.
Use Ubuntu Minimal Install for Lower Resource Consumption
Step 1: Select the “Minimal Install” option during Ubuntu installation. This setup skips nonessential applications, providing only the basics required for a functional desktop or server. Minimal install reduces both disk usage and background memory consumption, which is especially valuable for systems with limited RAM or storage.
Step 2: For servers, choose the official Ubuntu Server Minimal installation image. Testing shows that, after updates, a minimal server install uses about 19% less memory and 14% less disk space than the standard server install. This difference allows you to run more virtual machines or services on the same hardware, or keep more RAM available for applications.
Step 3: After installation, review installed packages. The ubuntu-desktop-minimal
meta-package is a collection of dependencies. Instead of installing it wholesale, consider manually installing only the specific packages you need. This approach lets you avoid components like configuration dialogs or file managers if they’re unnecessary for your use case.
Step 4: When installing with apt-get install --no-install-recommends ubuntu-desktop-minimal
, you can further restrict package installation to only the essentials, skipping recommended but non-critical software (such as browser snaps).
Switch to a Lightweight Desktop Environment or Window Manager
Step 1: Replace heavier desktop environments (like GNOME or KDE Plasma) with lighter alternatives. XFCE, LXQt, and MATE are popular choices that use far less RAM and CPU. For example, switching from GNOME to XFCE or LXQt can cut desktop memory usage by several hundred megabytes, freeing resources for your applications.
Step 2: For the lightest possible setup, consider using a standalone window manager such as Openbox, Fluxbox, or i3. These options provide basic window management without the overhead of a full desktop environment. This approach is ideal for kiosk systems, single-application setups, or situations where every megabyte counts.
Step 3: Remove or disable the display manager (such as GDM or LightDM) if you don’t require graphical login screens. Launch your session directly from the console to reduce background processes.
Remove Unnecessary Packages and Services
Step 1: Identify and uninstall software you do not use. Use apt remove
for unneeded applications, then run apt autoremove
to clean up leftover dependencies. For example, removing file managers like Nautilus, or configuration tools you don’t use, can clear out additional packages and further reduce memory usage.
Step 2: Disable unnecessary background services. Use systemctl
to review and stop services that aren’t required for your workflow. Disabling services like Bluetooth, printing, or remote desktop support can save both RAM and CPU cycles.
Optimize Swap and Memory Handling
Step 1: Configure dynamic swap files using the swapspace
package. This approach automatically grows or shrinks swap space based on demand, similar to how Windows and macOS manage virtual memory. Dynamic swap helps prevent out-of-memory freezes by providing extra breathing room when RAM is exhausted.
Step 2: Enable compressed RAM with zswap
. This kernel feature compresses memory pages before swapping them to disk, reducing swap usage and keeping the system responsive under memory pressure.
Step 3: Make sure your system is using a modern kernel with Multi-Generational LRU (MGLRU) support. MGLRU improves the kernel’s out-of-memory handling, reacting more quickly to memory shortages and avoiding system freezes.
Monitor and Troubleshoot Resource Usage
Step 1: Use tools like htop
or pstree
to identify high-memory or high-CPU processes. This helps you spot unnecessary background tasks or misbehaving applications that could be removed or replaced.
Step 2: Check your graphics drivers, especially if you notice abnormal CPU usage when moving the mouse or using the desktop. Integrated Intel and AMD graphics usually work out of the box, but proprietary NVIDIA drivers may need to be installed for best performance. Use glxinfo | grep -E "OpenGL vendor|OpenGL renderer"
to verify your GPU and driver status.
Step 3: Consider replacing heavy applications (like web browsers) with lightweight alternatives if you continue to experience freezes or slowdowns. For example, use Midori
or qutebrowser
instead of Firefox or Chrome on low-memory systems.
By combining Ubuntu’s minimal install with a lightweight desktop environment, targeted package removal, and optimized swap configuration, you can significantly reduce memory and disk usage, resulting in smoother performance on resource-limited hardware or virtual machines.
Member discussion