How To Install A Software In Ubuntu

How To Install A Software In Ubuntu

Reading time1 min
#Ubuntu#Linux#Software#APT#Snap#PackageManagement

Mastering Software Installation on Ubuntu: Beyond the Software Center

Relying exclusively on Ubuntu’s Software Center restricts flexibility and fails to surface what’s really happening during a package installation. For anyone tasked with maintaining more than one machine—or troubleshooting package failures in production—the GUI alone is inadequate. Direct interaction with package management tools (APT, Snap, direct .deb installs) provides speed, automation, and clarity not accessible through the graphical interface.


Why Command-Line Package Management?

  • Scriptability (automate configuration across fleets).
  • Immediate diagnostics (E: Unable to locate package ... or dependency errors surface instantly).
  • Flexibility: fallback to workarounds or alternate repo sources when packages go missing.
  • Complete control over package versions.

APT: The Default Package Manager

APT manages .deb packages sourced from /etc/apt/sources.list and /etc/apt/sources.list.d/. Most system-critical packages (and dependencies) reside here. Ubuntu 22.04 LTS (jammy), for example, ships with APT v2.4.

Typical Installation Cycle

Update the index, then install:

sudo apt update
sudo apt install vlc

Note: Skipping apt update leads to outdated package lists and “Unable to locate package” errors.

Removal and Purge

  • Remove binaries but preserve configs:
    sudo apt remove vlc
    
  • Remove binaries + configs:
    sudo apt purge vlc
    

Package Lookup

Partial name? Use:

apt search backup

APT search output includes summary, version, and install state.

Gotcha: Orphaned Dependencies

After removals, lingering dependencies can bloat disk usage:

sudo apt autoremove

Always check what will be removed—occasionally, you’ll spot an unexpected dependency tied to something critical.


Snap: Universal, Sandboxed Applications

Snap packages install to /snap and run in isolated environments using snapd (snapd version 2.60+ recommended with Ubuntu 22.04+). Critically, their confinement affects standard filesystem access unless --classic mode is used.

Example: Installing Slack

sudo snap install slack --classic
  • --classic disables strict confinement; be mindful of potential security impact.

Rollback Example:
To revert to previous version:

sudo snap revert slack

Listing and Removing

snap list            # Show installed snaps
sudo snap remove vlc # Remove a snap package

Side Note

  • Snap packages update automatically. Manual version pinning is not natively supported—sometimes undesirable on production systems requiring controlled update cycles.

Direct .deb Package Installation

Not discoverable via APT or Snap? Many vendors distribute .deb files directly (e.g., Chrome, proprietary IDEs). This approach bypasses package repositories, increasing risk of dependency drift.

Example: Google Chrome

  1. Download from vendor:
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    
  2. Install:
    sudo dpkg -i google-chrome-stable_current_amd64.deb
    
  3. Resolve missing dependencies (common with fresh images):
    sudo apt-get install -f
    
  4. Check for errors. Example:
    dpkg: error processing package google-chrome-stable (--install):
     dependency problems - leaving unconfigured
    
    Always resolve these before proceeding.

Note

Packages installed this way will not auto-update with apt upgrade.


PPAs: Personal Package Archives

PPAs deliver up-to-date builds unavailable in default repos. Risk: they can break compatibility with LTS releases if not maintained.

Install latest Git:

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

Remove PPAs if they break upgrades:

sudo add-apt-repository --remove ppa:git-core/ppa

Real-World: Automated Dev Environment Setup

A typical setup might combine methods:

#!/bin/bash

set -e

sudo apt update
sudo apt upgrade -y

# Essential tools
sudo apt install -y build-essential git curl vim

# Snap package install
sudo snap install docker

# Visual Studio Code direct install (one-liner fallback)
curl -L -o vscode.deb "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"
sudo dpkg -i vscode.deb || sudo apt-get install -f -y
rm vscode.deb

Note: This script presumes Ubuntu 20.04+, internet connectivity, and sufficient privileges. Be aware: mixing Snap and APT installs sometimes doubles up applications (e.g., two copies of vlc).


Key Takeaways

  • Master CLI tooling for transparency, speed, and repeatability.
  • Prefer APT/Snap for maintainability; .deb and PPA only where necessary.
  • Regularly audit installed packages (apt list --installed | grep '<pattern>', snap list).
  • Test installation changes in a VM or throwaway cloud instance—production servers merit caution.
  • Monitor /var/log/apt/history.log for a traceable install/uninstall history.

Practical mastery of Ubuntu software installation goes far beyond “click and wait.” It’s a foundation for resilient, traceable system management—critical in real operational environments.