Installing DEB Packages on Ubuntu
You can install a .deb package on Ubuntu using a few different methods, both with a graphical interface (GUI) and the command line (Terminal). The command line methods are often more powerful, especially for handling dependencies (other packages your software needs to run).
1. Command Line Method (Recommended: Using apt)
Using the apt package manager is the recommended command-line method because it automatically handles dependencies.
-
Open the Terminal: You can usually press Ctrl + Alt + T.
-
Navigate to the file’s location: If the
.debfile is in yourDownloadsfolder, you would use:cd ~/Downloads(This stands for ‘change directory’ to the Downloads folder in your home directory.)
-
Install the package: Use the
apt installcommand, making sure to include the./before the file name. The./tellsaptthat the file is a local file in the current directory.sudo apt install ./package_name.debsudo: Runs the command with administrator (root) privileges, which is needed for installing software.apt install: The command to install a package../package_name.deb: Replacepackage_name.debwith the actual name of your file (e.g.,./my-app_1.0.0_amd64.deb).- Automatic Dependency Handling:
aptwill automatically find and install any other necessary packages (dependencies).
2. Command Line Method (Alternative: Using dpkg)
The dpkg tool is the underlying package manager, but it does not automatically resolve dependencies. This means if your software needs other packages to run, dpkg will install the .deb file but report an error because the dependencies are missing.
-
Open the Terminal and navigate to the file’s location (same as above).
-
Install the package:
sudo dpkg -i package_name.debdpkg -i: The command to install a package.
-
Fix Dependencies (if necessary): If the installation fails due to missing dependencies, you can run
aptto fix them:sudo apt install -fapt install -f: The-fstands for “fix broken,” and it tellsaptto find and install the missing dependencies for any partially installed packages (like the one you just tried to install withdpkg).
3. Graphical Method
This method is the most straightforward for a beginner.
- Locate the
.debfile in your file manager (usually in theDownloadsfolder). - Double-click the file.
- The Ubuntu Software application (or the older Software Center) should open.
- Click the Install button.
- Enter your user password when prompted to authenticate and start the installation.
This graphical tool also handles dependencies automatically, similar to using the apt command.
This video shows how to install a deb file on Ubuntu using different methods, including dpkg and apt: How to install a deb file on Ubuntu.