Skip to content

Installing software (apt)

Jennings Zhang edited this page Dec 8, 2017 · 1 revision

This page covers software installation on Debian and Ubuntu based systems.

Background Like the Apple App Store, pre-compiled binaries are stored in your distro's software repositories ready for you to download and install. These "packages" are stable and secure. A CLI-based tool is used to interact with software repositories. If the package is not found in the official repositories, you may add third party repositories to your package manager, or you can compile the software from source.

Tips

The option [-y] assumes yes to all questions (confirmations). Every package manager sub-command listed below besides search requires root privileges.

apt provides a high-level front-end to the Debian package manager.

All Debian based distros, such as Ubuntu (and all Ubuntu based distros) use dpkg and apt.

  • apt install PKG installs the package listed. (accepts multiple parameters)
  • apt remove [--purge] PKG uninstalls the package. (accepts multiple parameters)
    • --purge, all (modified) configuration and data files are deleted as well.
  • apt update downloads all packages' information.
  • apt upgrade [pkg] upgrades the specified package, or upgrades every installed out-of-date package. (accepts multiple parameters)
  • apt autoremove removes all orphaned packages (unused dependencies).
  • apt search KEYWORD searches the repository for KEYWORD.

If the package is not in the official repos,

  • dpkg -i PACKAGE.deb installs a local package.
  • sudo add-apt-repository ppa:NAME/REPO && sudo apt-get update adds and configures third party repos to the package manager.

aptitude is an advanced alternative to apt.

Compiling software from source

Rarely, you will need to use software not found in your distro's official software repositories. Binaries can be generated by compiling from scratch with GNU autotools.

On Ubuntu: sudo apt install build-essential

The README or INSTALLATION file will likely provide information on dependencies and how to compile the software. It ususally follows this process:

  1. ./configure optimizes the build system for your machine.
  2. make generates the binaries.
  3. make install moves the binaries to directories in your $PATH, like /usr/local/bin/. This command might need sudo.

Using precompiled binaries

Not recommended.

Decompress the files and move the binaries to /opt/. Add the binaries to $PATH.