How To Install Programs On Ubuntu

How To Install Programs On Ubuntu

Reading time1 min
#Ubuntu#Linux#Software#Apt#Snap#Flatpak

Mastering Package Management: Installing Applications on Ubuntu with Apt, Snap, and Flatpak

Package management on Ubuntu is no longer just about apt-get install. As the landscape evolves, hybrid environments demand more nuanced solutions, particularly where exact dependencies, sandboxing, or immediate upstream updates are a concern. Seasoned engineers leverage Apt, Snap, and Flatpak side by side, each with distinct operational profiles.


Apt: The Backbone of Ubuntu Systems

apt is the classic utility for interacting with Ubuntu’s .deb repository. For most infrastructure workloads and system-critical applications, it remains the default.

Always update your package index before any install:

sudo apt update

Skipping this risks conflicts from outdated package metadata—a common source of E: Unable to locate package errors.

Example: Install nginx 1.18.0

sudo apt install nginx=1.18.0-6ubuntu14.4

For deterministic builds, pin specific versions. Expect dependencies to cascade; validate post-install with:

nginx -v

Removing packages (dependencies are not always purged):

sudo apt remove nginx
# For full cleanup:
sudo apt autoremove

Side note: Removing a package often leaves configuration files behind (/etc/nginx). For a clean slate, sudo apt purge nginx.


Snap: Canonical's Sandboxed Distribution

Engineers needing isolated, auto-updating versions of tools (frequently Chrome, Spotify, or microservices) lean on Snap. Snapd is preinstalled on Ubuntu 18.04 LTS+; verify with:

snap version

If missing:

sudo apt install snapd

Snap install example: Latest Chromium browser

sudo snap install chromium

This fetches upstream releases rapidly, but be aware: snap-perfect integration with native theming and filesystem is still imperfect in some edge-cases. Startup time is also nontrivial compared to native .deb variants—trade-off for sandboxing and rollback support.

List installed snaps:

snap list

Automated updates run in the background—this can interfere with reproducible deployments. To pin a version, Snap lacks built-in mechanisms (unlike Apt). The update schedule:

snap refresh --list

Gotcha: Snaps live in /snap and /var/snap, not /usr/bin. Scripts relying on expected binary paths will break unless symlinks are added manually.


Flatpak: Cross-Distribution Desktop Portability

For GUI applications that require sandboxing and cross-distro packaging, Flatpak provides advantages, particularly in desktop scenarios where you want parity between Ubuntu, Fedora, etc.

Flatpak install (on 22.04 LTS):

sudo apt install flatpak

Add Flathub (primary upstream source):

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Practical tip: Logout/login or reboot to ensure Flatpak is recognized by GNOME/KDE software centers.

Install GIMP:

flatpak install flathub org.gimp.GIMP

Search for a package:

flatpak search blender

Run application (syntax nontrivial for scripts):

flatpak run org.gimp.GIMP

Uninstall:

flatpak uninstall org.gimp.GIMP

Known issue: Flatpaks may not integrate with system-wide theme (Gtk/Qt) out of the box—extra theme Flatpaks or manual configuration sometimes required.


Choosing Tools for the Situation

ScenarioPreferred System
Build/release pipeline, SLAs, minimal varianceApt
Isolated, quickly-updated desktop applicationsSnap
Desktop apps, multi-distro engineering environmentsFlatpak
Legacy CLI deployments inside containersApt (or direct .deb)

Example: On a developer laptop, Firefox installed as a Snap gets security patches days before the deb. On a regulated production VM, Apt allows explicit reproducibility and easier diff tracking. Flatpak excels in mixed-distro desktop fleets—installing via Flathub ensures a single upstream appset, simplifying support.


Trade-offs and Non-Obvious Details

  • Apt: Integration with unattended-upgrades; dependency chains occasionally mutate as packages get rebuilt upstream. Some server environments enforce only signed debs from custom repos (/etc/apt/sources.list.d/).
  • Snap: Containerizes / auto-updates, but has limited customization. Startup latency for large GUIs is noticeable; also triggers AppArmor rules (check with dmesg | grep DENIED).
  • Flatpak: Best for GUI, but large runtimes (initial pull can reach hundreds of MB). Per-user install scope by default.

Practical tip: To debug “why does this app not see my files?”, check the sandbox’s restricted home directory bindings. Either adjust permissions (via snap connect/flatpak override) or revert temporarily to .deb packages for full legacy support.


Summary

Combining Apt, Snap, and Flatpak on Ubuntu enables precise control over software lifecycles. Use Apt for baseline OS and infrastructure, Snap for sandboxed/constantly updated tools, and Flatpak where cross-distro desktop consistency or sandboxing are non-negotiable.

Engineering reality: There is no universal “best” package manager—choosing the proper tool hinges on the target environment, update cadence, and operational constraints. Integration quirks exist; knowing when to accept or override defaults pays dividends in stability and speed.


References:

Still seeing odd install issues? Check for conflicting sources in /etc/apt/sources.list.d/ or residual user-level Snap/Flatpak configs in ~/.config/. There’s always another layer.