Package Installation in Linux

Linux offers a diverse type of package installation methods and each of them is tailored to specific distributions, package managers, and file types. For smooth software management, it is essential to have a clear understanding of these package managers and their installation methods.

Requirements to install packages in Linux:

  • You need to have sudo privileges.
  • You need to have snap and flatpak package managers installed.
  • Required .rpm file and .AppImage file needed to be downloaded beforehand.

[Distro Used Throughout the Tutorial: Ubuntu 23.04 and RHEL 9.2]

3 Easy Methods for Package Installation in Debian-based Linux Distribution

Debian-based Linux distribution forms a significant portion of the open-source operating system family. It inherited the stability of the Debian system. Ubuntu, Linux Mint, and Debian itself are some of the prominent Debian-based Linux distributions. Installing a software package in Debian-based Linux is now a much easier process with many different methods suited for different users.

In this article, I will show you three straightforward methods for package installation in Ubuntu. If you want to know how to uninstall an app package check this amazing article How to Uninstall Packages in Linux. Here for this demonstration purpose, I will be installing VLC in my system.

You can read our Comparative Analysis of Debian-based Methods to distinguish between these three methods and pick the best one for your need.

Method 01: Package Installation Using “apt” in Linux

APT (Advanced Package Tool) is one of the default package management tools in Ubuntu. It is very capable and user-friendly. You can use it to install an app package in your system. Now, follow the steps to install vlc package using apt:

  1. At first, open the Ubuntu terminal or press CTRL+ALT+T on the keyboard.
  2. Now, type the following command:
    sudo apt install vlc
    EXPLANATION
    • sudo: Permits administrative permission.
    • apt: Provides a high-level command line interface for the package management system.
    • install: It tells the apt command to install a specified app package.
    • vlc: App package name.

    how to install app package in debian based linux distributions using apt command

  3. After that hit ENTER. If you are asked for your sudo user’s password, provide it.press Y for confirming installation of app package
  4. Finally press Y for confirmation. After waiting for some time your app should be installed.

Method 02: Package Installation Using “dpkg”

DPKG (Debian Package) is a low-level package manager tool in Ubuntu. It can interact directly with each Debian package’s basic installation and configuration. To install an app package using the dpkg app manager you will need the .deb file of that app package. Now, follow the steps to accomplish this task:

  1. Before starting, download the .deb package file for the app you want to install. You can usually find it on the official website of the app or in third-party repositories. You can also create the .deb file from the .rpm file using the alien package.
  2. Now, run the following command in the Ubuntu terminal to move to the directory where the .deb file is located:
    cd Downloads/
    EXPLANATION
    • cd: Changes the current directory to the destination directory.
    • Downloads/: Name of the destination directory.
  3. After that, type the following command to view all the files and folders in that directory:
    ls
    EXPLANATION
    • ls: List all files and folders of the current directory in the command line.
  4. Finally, run the following command to install your app package:
    sudo dpkg -i vlc_3.0.19-1.4_amd64.deb
    EXPLANATION
    • dpkg: Low-level command line tool to directly manage Debian packages.
    • i: Command option to specify the dpkg command to install the specified app package.
    • 0.19-1.4_amd64.deb: .deb file of the app package.

    how to install app package in debian based distros using dpkg package manager.

    After installing the app package, your command line interface should look like the above image.

Method 03: Package Installation Using “apt-get”

In Ubuntu, apt-get is a command line tool for managing app packages. It is a part of the apt package manager. It can get package information, package dependency, and package from safe and trusted sources for installation, update, or removal of the package. Check the following steps to install a package using apt-get package manager:

  1. At first, type the following command in the Ubuntu terminal to update the package list to ensure that you have the latest information about available packages:
    sudo apt-get update
    EXPLANATION
    • apt-get: Debaian-based package management tool.
    • update: It tells the apt-get command to update the local package lists from set repositories.
  2. After that hit enter. You have to give the sudo user password in this step.
  3. Now, type the following command to search for the app you want to install:
    apt-cache search vlc
    EXPLANATION
    • apt-cache: Command line tool to search for package details and metadata in the local package cache without actually installing the app package.
    • search: It tells apt-cache to search for the package name.
    • vlc: Name of the package to search.

    Your terminal should look like this:

    update package list and search for app package using apt-get

    Then find the app you want to install.

    find the app package you want to install

  4. After, finding the app package name type the following command to install the app package using the apt-get command:
    sudo apt-get install vlc
    EXPLANATION
    • install: It is a command for apt-get that tell it to install the app package.

    install app package in debian based distros using apt-get

    Press Y to continue the installation process

  5. Now, hit enter and the app will be installed. After that, your command prompt will look similar to the above images.

Comparative Analysis of Debian-based Methods

In this section, I have shown 3 different methods of installing an app package in the Debian-based Linux distribution. For an easier understanding of which method is more suitable for your usage, here is a comparison of all methods.

Methods Pros Cons
apt
  • Fully automated.
  • Show suggestions for misspelled packages.
  • Limited to packages in official repositories only.
dpkg
  • Suitable for manual package management.
  • Work offline.
  • May not show detailed information.
apt-get
  • Compatible with scripting.
  • Widely known.
  • Can’t solve dependency issues automatically.

Among all three methods, apt is recommended to most users for its user-friendliness. The usage of apt-get and dpkg is situational. If you want complete control over your installation process then use dpkg and if you want to install an app package using script use apt-get.

3 Methods for Package Installation in Red Hat-based Linux Distribution

Red Hat-based Linux distributions such as Red Hat Enterprise Linux (RHEL), CentOS, and Fedora are built on the renowned Red Hat ecosystem. In this article, I will show three different ways for package installation in Red Hat-based distributions using rpm, yum, and dnf. By learning about these methods you can adeptly manage your software packages in your Red Hat-based operating system.

You can read our Comparative Analysis of Red Hat-based Methods to distinguish between these three methods and pick the best one for your needs.

Method 01: Package Installation Using the “rpm” command

Installing a package using rpm (Red Hat Package Manager) is one of the fundamental processes in Red Hat-based distributions. You can efficiently manage your system by using rpm for package installations, updates, and uninstallation. In the article How to Install Local Package Using RPM I have shown how you can install an app package using the rpm package manager in your Red Hat-based distro.

Method 02: Package Installation Using the “yum” Command

YUM (Yellowdog Updater Modified) is one of the most common package managers in Red Hat-based distros. It is built on top of rpm and provides many features that aren’t available in rpm. Using yum for package installation streamlines the process of handling dependencies ensuring a seamless user experience. For installing an app using yum check this detailed article How to Install RPM Packages Using YUM. If you want to install a specific app version follow How to Install Specific Version of a Package Using YUM. For installing from a local file How to Install Local Package Using YUM.

Method 03: Package Installation Using the “dnf” Command

DNF (Dandified YUM) emerges as a powerful package manager in Red Hat-based distributions replacing its predecessor yum. This modern package manager can seamlessly handle package installations, updates, and dependencies. By using dnf you can experience improved dependency handling, very fast execution, and a very smooth and streamlined installation process. For installing app packages using dnf check this detailed article How to Install RPM Packages Using DNF. For group installation using dnf check 2 Ways to Install Group Packages Using DNF. If you want to install from a local file follow How to Install Local Package Using DNF. To install rpm packages from a text file check this How to Install RPM Packages From Text File.

Comparative Analysis of Red Hat-based Methods

Check out the following comparison table between the discussed three methods of installing a package in Red Hat-based Linux distributions:

Methods Pros Cons
rpm
  • Offer precise control over the installation.
  • Work offline.
  • Very complex manual dependency management.
yum
  • Automatic dependency handling.
  • Provide automatic updates.
  • Replaced by dnf in some modern distributions.
dnf
  • Faster and more efficient.
  • More accurate dependency handling.
  • Older distributions may not have support for it.

If you prefer proper control over your package installation follow 1st method, for automatic dependency handling use method 2/3. If you don’t have any preference then method 3 is recommended.

4 Easy Methods for Universal Package Installation in any Linux Distribution

Among the diverse landscape of Linux distributions, the quest for universal package management methods has led us to many different versatile solutions. In this article, I will show 4 of those solutions – PackageKit, Snap, Flatpak, and AppImage. Irrespective of which Linux distribution you are using you can use these installation processes for hassle-free installation of the app packages. For this demonstration purpose, I am using Ubuntu to show the installation of app packages.

You can read our Comparative Analysis of Universal Methods to distinguish between these four methods and pick the best one for your needs.

Method 01: Package Installation Using PackageKit

Packagekit is a package management service that provides an easy-to-use graphical interface for package management in many Linux distributions. Follow the steps to install a package using the PackageKit:

  1. Click on the Ubuntu Software icon in the middle left edge of your system’s side panel.
  2. From there, select the search icon in the top left corner.
  3. Type the package name in the search bar.
  4. After that, from the found list, double-click on the app you want to install.how to install an app package in Linux using PackageKit
  5. Finally, click on the install icon.Click on install for auto download and then installation the app package

    Then, you will be asked to give the user password for installation authentication. After that, the app package will be downloaded and installed automatically.

Method 02: Package Installation Using Snap

Snap is a containerized package format and package manager. It is a cross-distribution app management tool. It provides a self-contained and sandboxed environment for app packages. To install a package using snap, check the steps below:

  1. To ensure that you have the most up-to-date information about available snap packages in Ubuntu first, open the Ubuntu terminal and execute the following command to update the snap package list:
    sudo snap refresh
    EXPLANATION
    • sudo: Permits administrative permission.
    • snap: Command line tool for managing snaps.
    • refresh: It tells the snap command to update the snap package list.
  2. Now, run the following command to search for the app you want to install:
    snap find vlc

    OR,

    snap search vlc
    EXPLANATION
    • find/search: It instructs the snap command to search for snaps for your desired package.
    • vlc: Name of the package to search.

    Your workflow till now should look like this image:

    update snap package list and search for your desired app package

  3. Then, type the following command to install the app package in your system:
    sudo snap install vlc
    EXPLANATION
    • install: It instructs the snap command to install the snap of your desired app package.

    install app package in any Linux distros using snap universal package manager

    After that hit ENTER and the app package and all its dependencies will be downloaded and installed. After the installation is finished your command prompt will look similar to the above image.

Method 03: Package Installation Using Flatpak

Flatpak is another universal package management package in Linux distributions. It provides sandboxed application deployment which means the users can install and run software in isolated environments, ensuring stability and security without worrying about their Linux distribution. Now, follow the steps to install vlc using flatpak:

  1. At first, open the Ubuntu terminal and execute the following command to search for the app package you want to install:
    flatpak search vlc
    EXPLANATION
    • flatpak: Command line tool for managing flatpak packages.
    • search: It tells the flatpak package to search the package name.

    You will see similar output in this image:

    search for app package in flatpak repositories

  2. Now, type the following command to search for the app you want to install:
    flatpak install flathub VLC
    EXPLANATION
    • install: It instructs the flatpak command to install the specified app package.
    • flathub: a popular remote repository that provides a wide range of Flatpak packages.

    install app package using flatpak

  3. After that hit ENTER. Then type the number of the one starting with the app. Then press Y for the package download to start. It will auto-install after the download is complete.

    Your terminal will look like this image:

enter the number with app in the list. press Y for confirmation.

Note: You can also visit the Flatpak package manager’s official repository Flathub website, search for a package, and copy the direct download command from there and install the package directly using that command.

Method 04: Package Installation Using AppImage

AppImage is a portable and self-contained application packaging format. It is a standalone file that runs on most Linux distributions without the need for installation. AppImage packages bundle all necessary dependencies, ensuring compatibility across different systems and versions. Users can easily run AppImage applications by making the file executable. It’s more convenient for users who don’t want to use package managers or need specific app versions without affecting system stability.

To install a package using AppImage, check the steps:

  1. At first, you have to download the AppImage file of your desired app package from their respective website or a third-party website (e.g. GitHub AppImage or AppImageHub). Now, type the following command in the Ubuntu terminal to move to the directory where the AppImage file is downloaded:
    cd Downloads/
    EXPLANATION
    • cd: This command changes the current directory to the destination directory.
    • Downloads/: Name of the destination directory.
  2. After that hit ENTER.
  3. Now, type the following command to view all the files and folders of that directory:
    ls -l
    EXPLANATION
    • ls: List all files and folders of the current directory in the command line.
    • l: show more details in the list.
  4. You can see the AppImage file is not executable. Now, type the following command to make the AppImage file executable:
    chmod +x VLC_media_player-3.0.11.1-x86_64.AppImage
    EXPLANATION
    • chmod: It instructs the snap command to search for snaps for your desired package.
    • +x: Name of the package to search.
    • VLC_media_player-3.0.11.1-x86_64.AppImage: Name of the file for changing permission.

    Your workflow till now should look like this image:

    move to Download folder directory and change execute permission of the AppImage file

    after gaining executable permission simply open the AppImage file to open the app package

  5. Finally, execute the following command to open the AppImage file as an app without installing it in your system:
    ./VLC_media_player-3.0.11.1-x86_64.AppImage

    You will see the above response and your app will be open.

Comparative Analysis of Universal Methods for Package Installation in Linux

Here, I have shown 4 different universal methods of installing an app package in Linux. The following comparison of all four methods will help you get an easier understanding of which method is more suitable for your usage:

Methods Pros Cons
PackageKit
  • User-friendly and visually easier to use.
  • Not all app packages are in the default repository of the Ubuntu Software app.
Snap
  • Cross-distribution support.
  • Isolated environment.
  • Separate package management system.
Flatpak
  • Cross-distribution support.
  • Independent of system library.
  • Isolated environment.
  • Larger file size.
  • Longer setup & startup time.
AppImage
  • No installation is needed.
  • Cross-distribution support.
  • Portable.
  • No automatic update.
  • The latest version of the app may not be available.

If you prefer the command line interface then you can use any method except the 1st method, if you prefer GUI then use the 1st method.

Error While Opening AppImage

When you are trying to open the AppImage file in your system you may see an error like dlopen ( ): error loading libfuse.so.2 that means libfuse.so.2 library is missing on your system or there are some issues with this version:

Error while opening the AppImage file

The AppImage file usually doesn’t require any special tool to run but some AppImage requires a utility named Fuse to run properly. To solve this problem you can simply install the fuse package in your system before opening your AppImage file. You can execute the following command in the terminal to install the fuse app package:

sudo apt install fuse

You may have to give the sudo user’s password for the installation.

Conclusion

In this article, I have discussed the different ways to install app packages in Linux. I have covered them based on their different usages. Among them, the best method to use will depend on your individual needs and preferences. No matter which method you choose, make sure to read the instructions carefully before you install any packages. This will help you to avoid problems. I hope this article is helpful for your task.

People Also Ask

How to install a local package in Linux?

To install a local package in Linux just run sudo dpkg -i <package pathname> in the terminal. It will automatically install the package in your system.

How to install a list of packages in Linux?

You can install a list of packages in Linux using the apt command. Execute sudo apt install package_1 package_2 package_3  and all packages will be installed.

How to List the Installed Packages in Linux?

To list all installed packages in Linux just run dpkg --list in your terminal. This command will display a comprehensive list of installed packages.

How to find a package in Linux?

You can use the apt command to search for a package in Linux. Execute apt search package_name to show a list of packages matching your search query.


Related Articles


<< Go Back to Package Management in Linux | Learn Linux Basics

5/5 - (10 votes)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
icon linux
Ridoy Chandra Shil

Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of “The Big Bang Theory”. Read Full Bio

Leave a Comment