How to Install deb Files (Packages) on Ubuntu 22.04

Install Deb Files on Ubuntu

Ubuntu is renowned for its ease of use and capable package management system. In most cases, the Ubuntu Software Center allows simple one-click access to popular apps.

However, there are instances when you need to install applications that are not available at the Software Center. In this situation, you need a .deb file (also known as a package) to install the application on your Ubuntu system.

The .deb files (packages) are a popular way of packaging all the required assets in a single file used to install applications on Ubuntu and other Debian-based distributions.

This guide will walk you through installing deb files on Ubuntu systems. We will cover installing the .deb files using the GUI and the terminal. Next, we will take a quick look at uninstalling .deb files from your system.

Prerequisites to Installing deb Packages on Ubuntu

Before you install .deb packages on Ubuntu systems, you need to make sure that you have the following:

  • A system running the latest stable Ubuntu version. (we have Ubuntu 22.04 on our test system)
  • Access to a terminal window.
  • A root user or a user with sudo rights

Use the GUI to Install deb Files On Ubuntu 22.04

The GUI greatly simplifies the process of installing deb packages in Ubuntu 22.04. We’ll describe the two most popular methods of installing deb packages via the GUI.

Method #1: Use the Software Center

Follow these easy steps to install a deb package using Ubuntu Software’s default Software Center:

The first step is to locate the deb package. Usually, the system saves the downloaded files in the Downloads directory.

Downloads directory visual

Right-click the deb file and select Open with Another Application from the context menu. Choose Software Install from the program list. To proceed, click the Install button.

software installation visual

When requested, enter the password and click Authenticate.

authentication required visual

Wait for the installation to finish. When complete, the software is ready for usage.

Method #2: Use the GDebi GUI to Install deb Files on Ubuntu

GDebi is a simple utility for installing local Debian packages. This Ubuntu package installer also detects all essential dependencies and downloads and installs them automatically using the APT package manager. 

GDebi is available both as a command-line tool and a graphical interface.

Note that GDebi is not installed by default on Ubuntu systems. We recommend using the following command to install it:

# sudo apt-get install gdebi -y

sudo apt-get install gdebi -y

Once the installation finishes, the utility is ready for .deb file installation. Follow these steps to install a deb package using the GDebi GUI:

  • Launch the file manager and browse to the deb file.
  • Right-click and choose Open With Other Application from the context menu.
  • Click GDebi Package Installer to select the option.

GDebi Package Installer

  • The installer loads the deb package and displays a description of the software. Click Install Package to begin the installation process.

package installer

  • When prompted, enter the password and hit Enter.
  • Wait for the installation to finish. The software is now ready for use.

Install deb Files From the Terminal

The Ubuntu terminal lets you install packages using various package managers and commands. 

We will now discuss the following three methods to install deb packages on Ubuntu in the terminal.

Method #1: Use The dpkg Utility to Install deb Files

The dpkg command is the Debian package manager that allows you to install, remove, and build packages. It comes pre-installed in Ubuntu 22.04 and later versions. However, if you are on an older version, you can easily install it with the sudo apt install dpkg command. 

Run the following command to install a deb package with the dpkg utility:

# sudo dpkg -i <package path> (Absolute path)

sudo dpkg -i <package path> (Absolute path)

Enter the user’s password and wait for the installation to finish.

IMPORTANT: The dpkg utility returns an error if a package depends on unavailable dependencies. If you encounter this error, we recommend manually downloading the missing dependencies and retrying the installation command.

NOTE: When working with packages, dpkg offers several options to evaluate the status of the packages. For instance, you can use dpkg -l (dpkg –list) to list packages. Similarly, you can view the files in a package with the dpkg -L <package name> command.

You can get the status of a package with the dpkg -s command. If you wish to view a specific file, use the dpkg -S command.

Method #2: Install deb Files Through the apt Package Manager

The apt command launches Ubuntu’s apt package management utility.

Run the following command to install a deb package with the apt utility:

# sudo apt install <package path>

 sudo apt install <package path>

If requested, enter the user’s password. The package manager can also automatically find and install any secondary dependencies.

Method #3: Use the GDebi Package Installer To Install deb Files on Ubuntu

GDebi can also be used as a command-line tool to install packages. Run the following command in the terminal to install a deb package with GDebi:

# sudo gdebi <package path>

sudo gdebi <package path>

After downloading the required dependencies, the command will ask your permission to install the package. Press Y to give permission and enter the user’s password.

How to Uninstall deb Packages

Ubuntu offers several methods for uninstalling a previously installed deb package. The process of removal is determined by how the package was previously installed. As such, we will discuss four methods corresponding to the four  ways of installing deb packages on Ubuntu.

Method #1: Use the Software Center to Uninstall deb Files on Ubuntu

We recommend the following steps to remove a deb package using the Ubuntu Software Center:

  • Launch the Ubuntu Software.

Launch the Ubuntu Software.

  • Go to the Installed tab.

Go to the Installed tab

  • Find the software you wish to uninstall. To uninstall the application, select Remove.

Find the software you wish to uninstall

  •  Confirm the uninstallation and provide the user’s password to complete the software removal.

Method #2: Use the GDebi GUI to Uninstall deb Packages

Run these steps to uninstall software using GDebi:

  • Find the .deb package file on your system.
  • Select Open With Other Application from the context menu.
  • From the options, select GDebi Package Installer.
  • To uninstall the software, click Remove Package.

To uninstall the software, click Remove Package.

  • Enter the user’s password and wait for the uninstall to finish.

Method #3: Use the dpkg Command To Uninstall deb Packages on Ubuntu

Use the following command in the terminal to uninstall packages installed with the dpkg utility:

# sudo dpkg -r <package name>

sudo dpkg -r <package name>

IMPORTANT: Remember to use the official package name (not the .deb file name) in the command.

Method #4: Remove deb Packages with the apt Package Manager

Run the following commands to uninstall a package using the apt command:

# sudo apt remove <package name>

sudo apt remove <package name>

To confirm the removal, press Y.

This method would work if you installed Ubuntu through the Ubuntu Software Center or the apt package manager.

Troubleshooting Dependency Issues

When installing .deb files on Ubuntu, you might encounter dependency-related errors. 

These issues occur when the package you’re trying to install requires other packages that are not currently installed on your system. Similarly, outdated packages on the system may also trigger these errors when they are called by the package managers. 

Here are some actions you can take to resolve these issues.

Tip #1: Start by Upgrading Package List

Before running the installation command, always update the installed packages by running the package manager’s upgrade command. For instance, run this apt command to upgrade the system package index:

# sudo apt upgrade && apt update

Tip #2: Fix Broken Dependencies

If you frequently encounter broken dependencies, we recommend running this command to fix the system’s  package index:

# sudo apt --fix-broken install

Tip #3: Clean the Package Index

Overtime, packages on your system can get corrupted. These corrupt packages can result in package installation issues. We suggest running the following commands to clean your package index:

#  sudo apt clean

# sudo apt autoclean

Now that you know how to install a deb package on Ubuntu and uninstall it, let’s take a closer look at deb packages and the benefits they bring to Ubuntu users.

What are deb Packages?

Debian-based operating systems like Ubuntu and Linux Mint use software packages known as deb packages (short for Debian packages). These packages include all files (including executables, scripts, and configuration files) required to install and run software.

You can install deb packages through methods such as package managers (like APT) and the dpkg command.

Developers use these interactive files to easily distribute and install a wide range of software on Debian-based systems. The structure of deb files ensures that all prerequisites are satisfied and configuration files are handled correctly.

The .deb packages provide a dependable and effective way to manage software repository installations on your Ubuntu or Linux Mint operating system. In effect, these files simplify the process of downloading packages from external repositories and manually installing package files.

Benefits of Using deb Packages

deb files offer various benefits, such as:

Benefit #1: Flawless Installation Experience

deb packages offer an easy and efficient installation procedure, allowing users to quickly install applications by double-clicking the package file. Users no longer need to manually download and install new files for software updates.

Benefit #2: Effective Package Management

deb packages ensure a clean and properly organized system by ensuring automatic installation and removal of packages. Package managers like dpkg and APT on the Ubuntu systems handle this process.

These package managers resolve package dependencies, sparing users from the hassle of finding and installing necessary libraries or components manually.

Benefit #3: Trusted Dependency Resolution

Package managers handle all underlying dependencies and ensure all necessary components are installed on the system. This prevents broken installation and similar dependency problems from affecting user experience.

Benefit #4: Smooth Updates

deb packages simplify the process of updating installed applications. The package managers fetch the most recent versions from the relevant package repository. Users can access the latest features, bug fixes, and security patches, ensuring their applications are up-to-date.

Getting Help With Installing deb Files on Ubuntu 22.04

The process of installing deb files on Ubuntu 22.04 through command line utilities such as dpkg or apt is straightforward. However, if you need help with the process or a specific command flag, we recommend checking Linux manual pages for the command. 

The typical syntax for accessing these pages is as follows:

# man <utility>

For instance, run this command to access the manual page for apt:

# man apt

man apt

Press ‘q’ to exit the man pages and return to the terminal. 

Conclusion

This guide goes into the details of how to install deb files on Ubuntu. As a basic security precaution, you need to be careful about the source of the package. 

While deb files provide flexibility, consider utilizing the Ubuntu Software Center or APT for a simpler package management experience because they handle dependencies and updates effortlessly.

FAQs

Q. What does the .deb package file type refer to?

A .deb file represents a package format used by Debian and its derivatives, such as Ubuntu. This file type encapsulates the necessary files for a specific software program along with the package’s metadata.

Q. What is a .deb package file type?

A .deb file is a Debian software package used in Debian-based Linux distributions like Ubuntu. It contains all the files needed for a particular software application and metadata about the package.

Q. Why would I need to install .deb files on Ubuntu?

You might need to install .deb files on Ubuntu if certain software or applications are not available in the official Ubuntu repositories or through a Personal Package Archive (PPA). Additionally, any software downloaded from the internet in .deb format would require installation.

Q. How do I install a .deb package file on Ubuntu?

To install a .deb file on Ubuntu, you have two primary methods: using the dpkg or apt commands. Follow these steps:

For dpkg: Open your terminal and change to the directory where the .deb file is stored. Execute the command sudo dpkg -i filename.deb, substituting filename.deb with your specific .deb file’s name.

For apt: In the terminal, type sudo apt install ./filename.deb, ensuring to replace filename.deb with the name of your .deb file.

Q. What’s the difference between dpkg and APT when installing .deb files?

dpkg is a basic package manager that directly handles the installation and management of .deb files, but it does not automatically resolve dependencies. This makes it suitable for straightforward package installations. Conversely, apt is a more advanced tool that not only manages packages but also automatically resolves and installs any necessary dependencies and handles package repository configurations.

Q. How do I resolve dependencies when installing .deb files?

When installing a .deb file that encounters unmet dependencies, you can address this by using the apt command with the -f option to automatically find and install any required dependencies. Simply execute sudo apt -f install following your initial attempt to install the .deb file.

Q. Can I uninstall a .deb package later?

To uninstall a .deb package, you can utilize either the dpkg or apt commands. With dpkg, the command is sudo dpkg -r package-name, and with apt, you should use sudo apt remove package-name.

Q. What if I encounter a Dependency error during installation?

If you face dependency errors while installing, these are typically due to missing dependencies. Ensure that all dependencies are resolved beforehand. Should dependency issues persist, consider consulting Ubuntu forums or community support for assistance.

Q. Is it safe to install .deb files from untrusted sources?

It is risky to install .deb files from sources that are not verified, as these files could potentially contain malware or damage your system. It is advisable to download and install .deb packages only from the official Ubuntu repositories, trusted Personal Package Archives (PPAs), or other reputable sources.

Q. Can I upgrade .deb packages using apt?

If you have installed a .deb package with apt, it integrates into your system just like packages from a repository. To upgrade it, you can use the command sudo apt upgrade whenever updates become available.

Q. Where can I find .deb files for Ubuntu?

.deb files for Ubuntu can be sourced from the software providers’ official websites, third-party repositories, or by compiling them from source code using utilities such as checkinstall. Always ensure that the sources from which you obtain these files are trustworthy.

Narendra

At Redswitches, Narendra works as a DC engineer full-time. He is in charge of Redswitches Asia DC, which is based in India. His area of expertise is server hardware. Rack and DC Operation resolving all OS-related concerns.

Related articles

Latest articles