Home

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).

Using the apt package manager is the recommended command-line method because it automatically handles dependencies.

  1. Open the Terminal: You can usually press Ctrl + Alt + T.

  2. Navigate to the file’s location: If the .deb file is in your Downloads folder, you would use:

    cd ~/Downloads
    

    (This stands for ‘change directory’ to the Downloads folder in your home directory.)

  3. Install the package: Use the apt install command, making sure to include the ./ before the file name. The ./ tells apt that the file is a local file in the current directory.

    sudo apt install ./package_name.deb
    
    • sudo: Runs the command with administrator (root) privileges, which is needed for installing software.
    • apt install: The command to install a package.
    • ./package_name.deb: Replace package_name.deb with the actual name of your file (e.g., ./my-app_1.0.0_amd64.deb).
    • Automatic Dependency Handling: apt will 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.

  1. Open the Terminal and navigate to the file’s location (same as above).

  2. Install the package:

    sudo dpkg -i package_name.deb
    
    • dpkg -i: The command to install a package.
  3. Fix Dependencies (if necessary): If the installation fails due to missing dependencies, you can run apt to fix them:

    sudo apt install -f
    
    • apt install -f: The -f stands for “fix broken,” and it tells apt to find and install the missing dependencies for any partially installed packages (like the one you just tried to install with dpkg).

3. Graphical Method

This method is the most straightforward for a beginner.

  1. Locate the .deb file in your file manager (usually in the Downloads folder).
  2. Double-click the file.
  3. The Ubuntu Software application (or the older Software Center) should open.
  4. Click the Install button.
  5. 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.

Tags: Linux, Cli