Mastering Ubuntu Software Installation: Advanced Techniques
Most Ubuntu users start with apt
:
sudo apt install package-name
It’s battle-tested. System libraries are managed, updates handled through apt-get upgrade
, and package signatures keep things secure. For standard utilities or services (e.g., curl
, htop
, postgresql
), this remains unmatched for reliability on Ubuntu 22.04 LTS and similar distributions.
But apt
isn’t always sufficient:
- You want the latest version, but the repo lags behind.
- Sandboxing is required for security.
- Proprietary software isn’t in any public repo.
- Rapid deployment across different Linux flavors.
- Conflicting dependencies or legacy libraries.
Here’s a breakdown of installation strategies when apt
falls short.
Snap: Containerized Packages, Centralized Updates
Snap, developed by Canonical, bundles application and dependencies, isolating them from the base system.
Install Snap if missing:
sudo apt update
sudo apt install snapd
Sample: Install the current stable Visual Studio Code.
sudo snap install code --classic
Remove:
sudo snap remove code
Quick facts:
- Snaps auto-update (with a delay up to 24h).
- Sandboxing via AppArmor restricts system access.
- Apps live in
/snap
and are managed by thesnapd
daemon.
Practical notes:
- Initial launch is noticeably slower—filesystem mounts are established on the fly.
- Snap apps can struggle with native theming; expect mismatches in certain WMs (e.g., i3, sway).
- Size: Even small tools might occupy 3–4× the disk vs. .deb.
Flatpak: Community-Driven Bundles with Broader Hardware Access
Flatpak, unlike Snap, is not controlled by one vendor and has become a standard for desktop applications, particularly on GNOME desktops.
First time setup:
sudo apt install flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Sample install (Spotify desktop):
flatpak install flathub com.spotify.Client
Run any Flatpak:
flatpak run com.spotify.Client
Uninstall:
flatpak uninstall com.spotify.Client
Considerations:
- Flathub repository contains most mainstream desktop apps.
- Integration with GNOME Software and KDE Discover is mostly seamless after logout/login.
- Flatpak has broad support on non-Ubuntu distributions—ideal for mixed fleets.
- Not all Flatpak apps support shell integration or advanced desktop hooks.
Known issue: If you get error: Unable to get org.freedesktop.Flatpak
, check D-Bus and restart the session. Integration occasionally fails with custom DEs or old Ubuntu LTS releases.
Direct .deb
Downloads: Proprietary or Bleeding-Edge Binaries
Vendors (e.g., Google, Slack) sometimes publish .deb
files directly, bypassing the standard repo channels. Use only when official repos or Snap/Flatpak aren’t an option.
Installing Chrome:
-
Download from https://www.google.com/chrome/
-
Navigate to your Downloads directory:
cd ~/Downloads
-
Install:
sudo dpkg -i google-chrome-stable_current_amd64.deb
-
If you see:
dependency problems - leaving unconfigured
then correct with:
sudo apt-get install -f
Note: These packages sometimes add their own APT repository (see /etc/apt/sources.list.d/
). Automatic updates may or may not occur depending on source.
Compiling from Source: Edge Cases, Custom Patches, or Unsupported Hardware
When no binary exists, or hardware support in mainline is lagging, compiling from source is necessary.
Sample: Latest htop
from GitHub.
sudo apt install build-essential autoconf automake pkg-config libncursesw5-dev git
git clone https://github.com/htop-dev/htop.git
cd htop
./autogen.sh
./configure
make
sudo make install
Non-obvious tip: Compilation may break due to missing dev headers (e.g., libncursesw5-dev
for interactive TUI apps). Examine config.log
for details on failures.
Drawbacks: No package manager integration—apt upgrade
won’t touch what you’ve built. Track patches and updates manually. Uninstall only by manually deleting binaries or using make uninstall
(if provided in Makefile).
At-a-Glance: Ubuntu Software Installation Methods
Method | Best For | Upsides | Limitations |
---|---|---|---|
apt | System components, services | Stable, seamless upgrades, signed | Lagging versions, no sandbox |
Snap | Bleeding-edge, isolation | Cross-distro, sandboxed, auto-update | Large size, slow start, theme pain |
Flatpak | Desktop apps, mixed distros | Independent, huge app lib | App integration glitches |
Manual .deb | Proprietary, vendor-offered | Official builds, one-step install | Dependency pain, manual cleanup |
Source | Custom or esoteric needs | Unlimited flexibility | Complex, no updates, risky |
Side Notes & Troubleshooting
- Mixing methods: You can, but conflicts over
/usr/bin
or.desktop
files can cause user confusion or, rarely, overwrite. Evaluate withwhich <app>
if unsure. - Check for active Snap services with
sudo systemctl status snapd
. - Flatpak updates are not tied to
apt upgrade
—runflatpak update
regularly. - Proxy environments: Snap and Flatpak require extra config (
/etc/environment
andsystemctl restart snapd
), especially on corporate networks. - Error on Snap install: If you see
cannot communicate with server: Post http://localhost/v2/snaps/...
, restartsnapd
or check for stale mounts.
Mastering these approaches gives you practical flexibility. Stable system tools? Stick with apt
. Need Chrome, Zoom, or something not in a repo? Use .deb
or Flatpak. Isolating critical workloads? Try Snap or Flatpak. Source builds remain the tool of last resort—necessary, but maintain with care.
For most engineers, a hybrid approach is the only realistic workflow on contemporary Ubuntu systems. Adjust according to your environment, risk profile, and support requirements. And remember—every installation method leaves a trail; check /usr/bin
, /snap
, /var/lib/flatpak
, and /opt
to audit your runtime environment.
Uninstall isn’t always clean—verify with dpkg -l
, snap list
, or flatpak list
.
If a package collides, investigate using ls -l $(which <app>)
to see which install source is winning.
Need a reference for an obscure setup? Or stuck with an error log? Drop specifics—most issues are easier to resolve than they first appear.