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
.debfiles.
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:
-istands 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.aptfetches 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 🚨
- Missing Dependencies Error:
sudo apt --fix-broken install
- Unmet Dependencies:
sudo apt install -f
- 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 🌐
- Download the Chrome
.debfile:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- Install using apt:
sudo apt install ./google-chrome-stable_current_amd64.deb
- Run Chrome:
google-chrome
8. Example – Installing Visual Studio Code 🖋️
- Download VS Code
.debfile:
wget https://go.microsoft.com/fwlink/?LinkID=760868 -O vscode.deb
- Install using gdebi:
sudo gdebi vscode.deb
- 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
