Linux, with its open-source philosophy and robust command-line interface, offers a powerful and flexible environment for managing software. Understanding how to install programs is a fundamental skill for any Linux user, whether you’re a beginner navigating your first distribution or an advanced user optimizing a custom build. This guide will delve into the primary methods for installing software on Linux, focusing on package managers, source compilation, and application-specific installers, ensuring you can equip your system with the tools you need.
The Power of Package Managers
Package managers are the cornerstone of software installation on Linux. They automate the complex process of downloading, installing, configuring, and updating software, ensuring that dependencies are met and that your system remains stable. Each major Linux distribution typically uses one or a few primary package management systems.

APT (Debian, Ubuntu, Mint)
Advanced Package Tool (APT) is widely used across Debian-based distributions, including Ubuntu and Linux Mint. It’s known for its ease of use and powerful dependency resolution capabilities.
Installing with apt
The primary command for installing a package using APT is apt install. You’ll typically need root privileges, so the command is often prefixed with sudo.
sudo apt install <package_name>
For example, to install the popular text editor vim, you would run:
sudo apt install vim
APT allows you to install multiple packages at once by listing them separated by spaces:
sudo apt install vim htop curl
Updating Package Lists and Upgrading Packages
Before installing new software, it’s good practice to update your local package index. This fetches the latest information about available packages and their versions from the repositories.
sudo apt update
Once your package list is updated, you can upgrade all installed packages to their latest available versions:
sudo apt upgrade
This command will upgrade packages that have newer versions available, but it will not remove existing packages or install new ones that are required as dependencies for upgrades. For a more comprehensive upgrade that can install or remove packages to satisfy dependencies, you can use apt dist-upgrade:
sudo apt dist-upgrade
Searching for Packages
If you’re unsure of the exact package name, you can search the APT cache:
apt search <keyword>
This will list all packages that contain the specified keyword in their name or description.
Removing Packages
To uninstall a package, use the remove command:
sudo apt remove <package_name>
This will remove the package but leave behind its configuration files. If you want to remove both the package and its configuration files, use purge:
sudo apt purge <package_name>
To clean up orphaned dependencies (packages that were installed as dependencies but are no longer needed by any installed package), use:
sudo apt autoremove
YUM/DNF (Fedora, CentOS, RHEL)
Yellowdog Updater, Modified (YUM) and its successor, DNF (Dandified YUM), are the package managers for Red Hat-based distributions. DNF is the modern and preferred tool, offering improved performance and dependency resolution compared to YUM.
Installing with dnf
Similar to APT, installing with DNF requires sudo privileges and the install command.
sudo dnf install <package_name>
For example, to install the nano text editor:
sudo dnf install nano
To install multiple packages:
sudo dnf install nano git wget
Updating and Upgrading
Updating the package cache with DNF:
sudo dnf check-update
To upgrade all installed packages:
sudo dnf upgrade
Searching for Packages
To search for packages with DNF:
dnf search <keyword>
Removing Packages
To remove a package with DNF:
sudo dnf remove <package_name>
DNF automatically handles the removal of unneeded dependencies.
Pacman (Arch Linux, Manjaro)
Pacman is the package manager for Arch Linux and its derivatives. It’s known for its simplicity and speed.
Installing with pacman
Pacman commands typically require root privileges.
sudo pacman -S <package_name>
To install the vim editor:
sudo pacman -S vim
To install multiple packages:
sudo pacman -S vim htop curl
Synchronizing and Upgrading Packages
Before installing, it’s essential to synchronize your local package database with the repositories and upgrade your system.
sudo pacman -Syu
This command first synchronizes (-y) and then upgrades (-u) all outdated packages.
Searching for Packages
To search for packages with Pacman:
pacman -Ss <keyword>
Removing Packages
To remove a package:
sudo pacman -R <package_name>
To remove a package and its dependencies that are not required by any other package:
sudo pacman -Rs <package_name>
Compiling from Source
While package managers are the most common and convenient way to install software, sometimes you might need to compile a program directly from its source code. This is often necessary for:
- Latest versions: Accessing bleeding-edge versions of software not yet packaged.
- Customization: Configuring build options to tailor the software to your specific needs or hardware.
- Proprietary software: Software that isn’t distributed through standard repositories.
- Troubleshooting: Installing a specific version to resolve a bug.
The process generally involves three main steps: configuring, compiling, and installing.
The ./configure, make, make install Workflow
This is a classic and widely adopted method for building software from source.
Step 1: Obtain the Source Code
First, you need to download the source code archive, usually a .tar.gz or .zip file, from the software’s official website or repository. Once downloaded, extract the archive to a suitable directory.

tar -xf <source_archive.tar.gz>
cd <source_directory>
Step 2: Install Build Dependencies
Most source-based applications require a set of development tools and libraries to compile. These are often referred to as “build-essential” or “devel” packages. The README or INSTALL file within the source directory usually lists these dependencies. You’ll typically install them using your distribution’s package manager.
For Debian/Ubuntu:
sudo apt install build-essential checkinstall git automake autoconf libtool
For Fedora/CentOS/RHEL:
sudo dnf groupinstall "Development Tools"
For Arch Linux:
sudo pacman -S base-devel
Step 3: Configure the Build
The ./configure script analyzes your system, checks for dependencies, and generates a Makefile tailored to your environment. You can often pass various options to ./configure to customize the installation. To see available options, run:
./configure --help
A common command to run configuration is:
./configure
You might encounter errors if required dependencies are missing. The output of ./configure will usually indicate what is needed.
Step 4: Compile the Source Code
Once configure completes successfully, you can compile the source code using the make command. This reads the Makefile and invokes the compiler.
make
This step can take a significant amount of time, depending on the size of the software and your system’s processing power.
Step 5: Install the Program
After successful compilation, use make install to copy the compiled binaries, libraries, and documentation to their appropriate locations on your system.
sudo make install
Step 6: Clean Up (Optional but Recommended)
After installation, you can clean up the build directory to save space.
make clean
Using checkinstall for Easier Management
The make install command directly installs files to system directories, making uninstallation difficult if you need to remove the program later. checkinstall is a utility that can automate the creation of a native package (like a .deb for Debian/Ubuntu or .rpm for Fedora/CentOS) from your compiled source. This makes it much easier to uninstall the program later using your system’s package manager.
To use checkinstall:
-
Install
checkinstall:- Debian/Ubuntu:
sudo apt install checkinstall - Fedora:
sudo dnf install checkinstall
- Debian/Ubuntu:
-
Run
checkinstallaftermake:
After you’ve successfully runmake(but beforemake install), runcheckinstall:sudo checkinstallcheckinstallwill prompt you for information about the package and then build and install it. You can later uninstall it usingsudo dpkg -r <package_name>(for.deb) orsudo rpm -e <package_name>(for.rpm).
Flatpak and Snap Packages
Beyond traditional package managers and source compilation, two modern universal package management systems have gained significant traction: Flatpak and Snap. These systems aim to provide a consistent way to install and run applications across different Linux distributions, offering sandboxing for improved security and easier application updates.
Flatpak
Flatpak is designed for desktop applications. It allows applications to be installed in isolated environments called “sandboxes,” with controlled access to system resources.
Installing Flatpak
First, ensure Flatpak is installed on your system. Most modern distributions have it available in their repositories.
- Debian/Ubuntu:
sudo apt install flatpak - Fedora:
sudo dnf install flatpak - Arch Linux:
sudo pacman -S flatpak
You’ll also want to add the Flathub repository, which is the largest source of Flatpak applications.
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Installing Applications with Flatpak
Once Flatpak and Flathub are set up, you can install applications directly from the command line.
flatpak install flathub <application_id>
The <application_id> is typically found on the Flathub website (e.g., com.spotify.Client, org.mozilla.firefox).
Running and Managing Flatpak Applications
To run a Flatpak application:
flatpak run <application_id>
To list installed Flatpak applications:
flatpak list
To update all installed Flatpak applications:
flatpak update
To uninstall a Flatpak application:
flatpak uninstall <application_id>
Snap
Snaps are another form of universal Linux package, developed by Canonical (the creators of Ubuntu). Like Flatpak, they run in sandboxed environments, ensuring that applications don’t interfere with each other or the host system.
Installing Snapd
Snap packages are managed by snapd, a background service. Install snapd first.
- Debian/Ubuntu:
sudo apt install snapd - Fedora:
sudo dnf install snapd - Arch Linux:
sudo pacman -S snapd
After installation, you might need to log out and log back in for the snap command to be recognized.
Installing Applications with Snap
The command to install a snap package is snap install.
sudo snap install <package_name>
For example, to install Spotify:
sudo snap install spotify
Running and Managing Snap Applications
Snaps are usually automatically available in your PATH after installation, so you can run them by their command name (e.g., spotify).
To list installed snap packages:
snap list
To refresh all snap packages:
sudo snap refresh
To remove a snap package:
sudo snap remove <package_name>
Application-Specific Installers
Some software, particularly proprietary applications or those that require specific installation procedures, may provide their own dedicated installer scripts or binaries. These are often distributed as .run files, .sh scripts, or executable binaries.

Executable Scripts and Binaries
When you download an installer file (e.g., software_installer.run), you typically need to make it executable before you can run it.
-
Make executable:
chmod +x software_installer.run -
Run the installer:
./software_installer.runFollow the on-screen prompts provided by the installer. These installers might place executables in
/usr/local/bin, libraries in/usr/local/lib, and configuration files in/etc/.
Important Considerations for All Installation Methods:
- Root Privileges (
sudo): Most installation commands require root privileges to modify system directories. Always usesudowith caution. - Dependencies: Ensure all necessary dependencies are installed before attempting to compile from source or run complex installers. Package managers usually handle this automatically.
- Documentation: Always refer to the official documentation of the software you are installing. It will provide the most accurate and up-to-date instructions.
- Repository Trust: When using package managers, be mindful of the repositories you add. Only use trusted sources to avoid security risks.
- Sandboxing: Flatpak and Snap offer enhanced security through sandboxing, which can be a significant advantage for applications from less trusted sources or for isolating potentially risky software.
Mastering these different methods for installing programs on Linux empowers you to customize your system precisely to your needs, whether it’s by leveraging the efficiency of package managers, the flexibility of source compilation, or the modern convenience of universal packaging formats.
