Install .deb Files in Ubuntu

Ubuntu 22.04 LTS (Jammy Jellyfish) is a powerful and user-friendly Linux distribution that supports the installation of software packages using .deb files. A .deb file is a Debian Software Package that contains the necessary files to install an application or software in Ubuntu or Debian-based systems. This post explores various ways to install .deb files in Ubuntu 22.04 through the terminal, addressing different scenarios you might encounter.


Why Use .deb Files? 🗂️

  • Offline Installation – No need for internet access during installation.
  • Software Not in Repositories – Some applications aren’t available through Ubuntu’s default repositories.
  • Latest Software Versions – Developers often distribute the latest releases as .deb files.

Prerequisites 🛠️

  • Ubuntu 22.04 LTS installed
  • Access to the terminal
  • Administrative privileges (sudo)

1. Installing .deb Files Using dpkg (Debian Package Manager) 📦

The dpkg command is the standard way to install .deb files.

Basic Command:

sudo dpkg -i package_name.deb

Example:

sudo dpkg -i google-chrome-stable_current_amd64.deb

Explanation:

  • -i stands for install.
  • If dependencies are missing, the installation might fail.

Fixing Dependency Issues 🔄:

sudo apt --fix-broken install

This command attempts to fix broken dependencies that may arise during the installation.


2. Installing .deb Files Using apt (Advanced Packaging Tool) 🧰

apt handles dependencies automatically, making it a preferred choice.

Basic Command:

sudo apt install ./package_name.deb

Example:

sudo apt install ./google-chrome-stable_current_amd64.deb

Explanation:

  • ./ specifies the file path.
  • apt fetches and installs missing dependencies if required.

3. Installing .deb Files Using gdebi (Graphical & Terminal-Based Installer) 🖥️

gdebi is a lightweight tool designed to handle .deb installations by resolving dependencies.

Install gdebi First:

sudo apt install gdebi-core

Use gdebi to Install .deb File:

sudo gdebi package_name.deb

Example:

sudo gdebi google-chrome-stable_current_amd64.deb

4. Checking Installed Packages with dpkg-query 🧾

To confirm if the package is installed:

dpkg-query -l | grep package_name

Example:

dpkg-query -l | grep chrome

5. Common Errors and Troubleshooting 🚨

  1. Missing Dependencies Error:
sudo apt --fix-broken install
  1. Unmet Dependencies:
sudo apt install -f
  1. Locked dpkg Database:
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a

6. Removing Installed .deb Packages 🗑️

Using dpkg:

sudo dpkg -r package_name

Using apt:

sudo apt remove package_name

7. Example – Installing Google Chrome 🌐

  1. Download the Chrome .deb file:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  1. Install using apt:
sudo apt install ./google-chrome-stable_current_amd64.deb
  1. Run Chrome:
google-chrome

8. Example – Installing Visual Studio Code 🖋️

  1. Download VS Code .deb file:
wget https://go.microsoft.com/fwlink/?LinkID=760868 -O vscode.deb
  1. Install using gdebi:
sudo gdebi vscode.deb
  1. Launch VS Code:
code

9. Verifying Installations ✅

dpkg -l | grep package_name

Example:

dpkg -l | grep code

10. Uninstalling .deb Files 🗑️

sudo apt remove package_name

Example:

sudo apt remove code

 

Related articles

How to Create Custom Roles in GCP

How to Create Custom Roles in GCP Google Cloud Platform (GCP) offers powerful IAM (Identity and Access Management) features...

what is multi cloud

What is Multi Cloud? Introduction In today’s digital era, multi-cloud strategies have become a cornerstone of enterprise IT. Multi-cloud refers...

How to use AWS Elastic Beanstalk for Application Deployment

🚀 How to use AWS Elastic Beanstalk for Application Deployment AWS Elastic Beanstalk is one of the easiest and...

What are Git Hooks

What are Git Hooks Git hooks are powerful automation tools that allow developers to enforce coding standards, automate testing,...