How do I install a .deb file via the command line?

To install a .deb file via the command line in a Debian-based system (like Ubuntu), follow these steps:

  1. Open a terminal window.
  2. Navigate to the directory where the .deb file is located using the cd command. For example, if the file is in your “Downloads” folder, you can type:
cd ~/Downloads
  1. Install the .deb package using the dpkg command followed by the -i (install) flag and the name of the .deb file. For example, if the file is named “example-package.deb”, you would type:
sudo dpkg -i example-package.deb
  1. If the installation requires additional dependencies, you might encounter errors. To resolve these dependencies, run the following command:
sudo apt-get install -f

This command will automatically try to fix broken dependencies by downloading and installing the required packages.

  1. After resolving the dependencies, the package should be installed successfully. You can verify its installation by checking its version using the dpkg command with the -l (list) flag and the package name. For example:
dpkg -l example-package

Remember to replace “example-package” with the actual name of the package you installed.

Related Solutions