To install a .deb file in Ubuntu using a terminal or CLI use the command “sudo dpkg -i package.deb“.
Let’s understand this with the help of an example.
Installing programs in Ubuntu Linux is typically done through the Ubuntu Software Center or the apt packaging system using the terminal.
However, sometimes a developer will provide software as a .deb file instead of through a repository. A .deb file contains all the necessary files to install an application in Debian-based Linux distributions like Ubuntu.
Table of Contents
Installing a .deb package file using the command line is quick and easy if you follow the below steps.
Before installing a .deb file, ensure you have downloaded or transferred the file to your Ubuntu desktop or server.
You will need to know the location of the file to install it. It is also good practice to scan any files downloaded from the internet for malware before installing them on your system.
How to Install a .deb File
Step 1: Open Terminal
First, open the Terminal application which can be found by pressing Ctrl+Alt+T or searching for “Terminal” from the Ubuntu dash. The terminal enables you to enter Linux commands to interact with the operating system.
Step 2: Navigate to File Location
Next, you will need to navigate to the folder location that contains your .deb package installation file. For example, if the .deb file is on your desktop, enter this command in the terminal then hit enter:
Step 3: Install the Package
With your terminal open in the directory containing the .deb package, type the following command to install the package, replacing “package-name.deb” with your actual filename:
sudo dpkg -i package-name.deb
sudo: This command gives you superuser privileges required for installation.
dpkg -i: This tells the system to install the specified .deb file.
Enter your user password when prompted. The dpkg command handles package installation, removal, and building tasks. The -i flag installs a package.
Here is an example:
In this example, we are installing Nord VPN on Ubuntu, which is a popular VPN for secure browsing.
ubuntu@ubuntu:~/Downloads$ sudo dpkg -i nordvpn-release_1.0.0_all.deb
[sudo] password for ubuntu:
Selecting previously unselected package nordvpn-release.
(Reading database ... 147535 files and directories currently installed.)
Preparing to unpack nordvpn-release_1.0.0_all.deb ...
Unpacking nordvpn-release (1.0.0) ...
Setting up nordvpn-release (1.0.0) ...
Step 4: Resolve Any Missing Dependency Issues
If the package has any dependencies that are missing on your Ubuntu system, you may see error messages about missing required libraries or packages after running the installation command.
To fix this, you can install the missing packages with the help of the apt install command.
sudo apt install <Package-name>
You can also try –fix-broken option
sudo apt --fix-broken install
sudo apt-get -f install
This command tells apt to fix any broken packages and unmet dependencies by installing the required packages. After it completes, you can retry installing the deb file.
That’s it! The .deb package should now be successfully installed using the command line in Ubuntu. You can launch and test out the application you installed or run dpkg -s packagename to verify it is set up properly.
Using the Ubuntu terminal to install deb files gives you more control and options over just double-clicking packages in the Ubuntu GUI.