Skip to main content

Command Palette

Search for a command to run...

A Step-by-Step Guide to Installing Software on Linux

A Beginner’s Guide to installing software on Ubuntu and Other Distros

Updated
4 min read
A Step-by-Step Guide to Installing Software on Linux
J

I'm a software developer from Nigeria with a passion for documentation. I love to help others solve problems and gain more knowledge in matters related to tech development.

Introduction

Installing software on Linux can seem daunting for beginners, but with the right tools and knowledge, it becomes a straightforward process. This guide will walk you through using package managers, alternative installation sources, and best practices to ensure a smooth software installation experience on your Linux system.

What is a Software Package?

A software package in Linux is a compressed archive containing all the necessary files for a particular software to run. These packages are managed by package managers, which simplify the process of downloading, installing, updating, and removing software.

What is a Package Manager?

A package manager is a tool that automates the process of managing software packages. Here are some of its key functions:

  • Downloads, installs, and updates software from repositories.

  • Ensures the integrity and authenticity of the packages.

  • Manages and resolves all required dependencies.

  • Places files in the correct locations within the Linux file system.

  • Simplifies system upgrades.

Every Linux distribution includes a package manager. For example, Ubuntu uses APT (Advanced Package Tool).

How to Manage Software with APT on Linux

APT is the default package manager for Debian-based distributions like Ubuntu. Here are some basic commands to get you started:

Searching for Packages on Linux

To search for a package, use the following command:

sudo apt search <package_name>

For example:

sudo apt search openjdk

You can also search for packages by typing commands related to the software you want to install. For instance, searching for java will provide recommendations.

Installing a Package on Linux

To install a package, use the command:

sudo apt install <package_name>

For example:

sudo apt install openjdk-11-jre-headless

To verify the installation:

java --version

How to Uninstall a Package on Linux

To remove a package, use:

sudo apt remove <package_name>

For example:

sudo apt remove openjdk-11-jre-headless

APT-GET vs. APT

While APT-GET is another package manager, APT is more user-friendly with fewer but more organized command options. Both serve similar functions, but APT provides a more streamlined experience.

Repositories

Repositories are storage locations containing thousands of programs. The package manager fetches packages from these repositories. Always update the package index before installing or upgrading software:

sudo apt update

The above lines of code refreshes the state of the APT repositories, ensuring you get the latest package information.

Alternative Sources for Software Installation on Linux

Sometimes, packages might not be available or up-to-date in the official repositories. Here are some alternative methods to install software:

Ubuntu Software Center

A graphical interface for managing software, useful for users who prefer a GUI over the command line.

Ubuntu Software Center

Snap Package Manager

Snap is a package manager for Linux that simplifies the installation of software across different distributions.

To install a snap package:

sudo snap install <package_name>

For example, to install Visual Studio Code:

sudo snap install --classic code

Verification

After the installation completes, you can verify the installation by running:

code --version

Differences Between Snap and APT

  • APT: Traditional package manager for installing software from distribution repositories.

  • Snap: Package manager that packages software along with its dependencies, ensuring compatibility across different Linux distributions.

Adding Repositories

You can add third-party repositories to APT sources to install additional software:

  1. Add the repository:

     sudo add-apt-repository ppa:<repository_name>
    
  2. Update the package index:

     sudo apt update
    
  3. Install the package:

     sudo apt install <package_name>
    

PPAs (Personal Package Archives) are commonly used to provide software updates more quickly than the official Ubuntu repositories.

Do All Linux Distros Use the Same Package Managers?

No, different Linux distributions use different package managers based on their source code and structure. For example:

  • Debian-based: Uses APT or DPKG (e.g., Ubuntu, Linux Mint).

  • Red Hat-based: Uses YUM or DNF (e.g., Fedora, CentOS).

Conclusion

Installing software on Linux is a manageable task once you understand the role of package managers and repositories. By using APT, Snap, and adding repositories, you can easily install, update, and remove software on your Linux system.