In this article, we will learn how to install deb files on Ubuntu that are not available in official repositories of Ubuntu. Some other useful commands helpful for handling “.deb” packages will also be covered.
Prerequisites
- Access to a terminal
- The apt package manager
- A user with sudo privileges
Downloading deb Files
For the purposes of demonstration, we will download and install the VsCode deb file. Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft for Windows, Linux, and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.
Launch your web browser and navigate to the VsCode for Linux download page. Download the deb package by clicking on the Linux 64bit download link.
If you prefer the terminal, you can download the deb file with wget
$ wget https://az764295.vo.msecnd.net/stable/6d9b74a70ca9c7733b29f0456fd8195364076dda/code_1.70.1-1660113095_amd64.deb
Installing deb Files from the Command Line
When it comes to installing deb packages from the command line we have several tools. In the following sections, we will show you how to use apt, dpkg, and gdebi utilities to install deb packages.
Installing deb files with apt
apt is a command-line utility for installing, updating, removing, and otherwise managing deb packages on Ubuntu, Debian, and related Linux distributions.
To install local deb packages with apt you need to provide the full path to the deb file. If the file is located in your current working directory instead of typing the absolute path, you can prepend ./ before the package name. Otherwise, apt will try to retrieve and install the package from Ubuntu’s repositories.
$ sudo apt install ./code_1.70.1_amd64.deb
if you will be prompted to type Y to continue:
$ sudo apt install ./code_1.70.1_amd64.deb [sudo] password for techdhee: Reading package lists... Done Building dependency tree... Done Reading state information... Done Note, selecting 'code' instead of './code_1.70.1_amd64.deb' The following NEW packages will be installed: code 0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded. Need to get 0 B/85.2 MB of archives. After this operation, 359 MB of additional disk space will be used. Get:1 /home/techdhee/code_1.70.1_amd64.deb code amd64 1.70.1-1660113095 [85.2 MB] Selecting previously unselected package code. (Reading database ... 199013 files and directories currently installed.) Preparing to unpack .../techdhee/code_1.70.1_amd64.deb ... Unpacking code (1.70.1-1660113095) ... Setting up code (1.70.1-1660113095) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) ... Processing triggers for shared-mime-info (2.1-2) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ... Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
The apt
package manager will resolve and install all the package dependencies.
Installing deb files with dpkg
dpkg is a low-level package manager for Debian-based systems. Use the -i (or –install) option to install deb packages with dpkg.
$ sudo dpkg -i code_1.70.1_amd64.deb
$ sudo dpkg -i code_1.70.1_amd64.deb [sudo] password for techdhee: Selecting previously unselected package code. (Reading database ... 199013 files and directories currently installed.) Preparing to unpack code_1.70.1_amd64.deb ... Unpacking code (1.70.1-1660113095) ... Setting up code (1.70.1-1660113095) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) ... Processing triggers for desktop-file-utils (0.26-1ubuntu3) ... Processing triggers for shared-mime-info (2.1-2) ...
Installing deb files with gdebi
gdebi is a tool for installing local deb packages. It is not installed by default in Ubuntu, but you can install it with the following command:
$ sudo apt install gdebi
To install the deb package with gdebi type:
$ sudo gdebi code_1.70.1_amd64.deb
Type y when prompted and gdebi will resolve and install the deb package and all its dependencies for you.
$ sudo apt install -f
$ sudo gdebi code_1.70.1_amd64.deb Reading package lists... Done Building dependency tree... Done Reading state information... Done Reading state information... Done Code editing. Redefined. Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ. Do you want to install the software package? [y/N]:y /usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1 c = findall("[[(](\S+)/\S+[])]", msg)[0].lower() Selecting previously unselected package code. (Reading database ... 215242 files and directories currently installed.) Preparing to unpack code_1.70.1_amd64.deb ... Unpacking code (1.70.1-1660113095) ... Setting up code (1.70.1-1660113095) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) ... Processing triggers for desktop-file-utils (0.26-1ubuntu3) ... Processing triggers for shared-mime-info (2.1-2) ...
Installing deb Packages using GUI
If you prefer to use a graphical interface, simply download the deb file and open it with a double click or right click on it.
This will open the default distro Graphical Software Center:
The installation may take some time depending on the file size and its dependencies.
Once the deb package is installed, the “Install” button within the Ubuntu Software Center will change to “Remove”.
That’s all, the application has been installed on your system and you can start using it.
Conclusion
We have shown you how to install local deb files in Ubuntu. When installing packages from the command line prefer using apt
as it will resolve and install all the package dependencies.
Related Linux Tutorials: