How to Install a .deb File on Ubuntu

29/12/2020
Different software of Linux used to be distributed as only source code many years ago. We had to compile the software from source in order to use it. If a software source depended on other libraries, then we had to download that library’s source code as well and compile it before compiling the software we wanted to install. If that library depended on some other libraries, then we had to download the source of these libraries and compile them as well. We had to go through whole bunch of dependency problems, which is called “dependency hell” at that time. There was no packaging system like we have today. These days, packages are pre-compiled for different machine architectures and kept on a central server (called package repository) and a package management software is used to automatically download, resolve dependencies and install it for us.

On Debian based Linux distributions such as Debian GNU/Linux, Ubuntu, Linux Mint and others, APT package manager is used. The package format of APT package manager is DEB archive. The extension of a DEB archive is .deb.

These days, most of the common software packages are available in the official package repository of the Linux distribution we are using. So we can easily install it using the package manager, in case of Ubuntu/Debian the APT package manager. But there are still times when a software we want is not available in the official package repository and we have to download the DEB package file from the official website of that software and install it on our Ubuntu/Debian operating system manually.

In this article, I am going to show you how to install a DEB file on Ubuntu. I am going to use Ubuntu 18.04 LTS for the demonstration. Let’s get started.

Installing DEB File from the Command Line:

You can use the dpkg command on Ubuntu to install a DEB file.

I downloaded the Apache 2 web server DEB file from https://packages.ubuntu.com just for the demonstration. Of course you can install it with APT package manager very easily. But I will show you how to install the it from the DEB file.

Now open a Terminal in the same directory as your DEB file. As you can see, the DEB file is available in the directory.

Now install it with the following command:

$ sudo dpkg -i apache2_2.4.29-1ubuntu4.1_amd64.deb

As you can see, the installation failed because the dependencies could not be resolved. The DEB package apache2 depends on apache2-bin, apache2-utils, apache2-data none of which are installed.

Now to resolve the dependencies, you have to install these packages first before you can install apache2 package.

Luckily for us, the dependency packages are available in the official package repository of Ubuntu. So all we need to do is run the following command:

$ sudo apt -f install

As you can see, the APT package manager resolved all the dependencies automatically. Now press y and then press <Enter>.

The package apache2 should be installed.

As you can see, Apache 2 works.

At times, the dependency packages won’t be available in the official package repository of Ubuntu. In that case, you have to find the required DEB packages on the internet and install it using dpkg as well. You will also have to resolve any dependency these dependency packages will have as well. This gets harder and harder as dependency increases and is very impractical for DEB files that has many dependencies.

Installing DEB File Using Ubuntu Software Center:

You can also install a DEB file using Ubuntu Software Center. Just right click on the DEB file and click on Open With Software Install.

Now click on Install.

Now type in your password and click on Authenticate.

The dependencies should be automatically resolved if it is available in the Ubuntu package repository and the software should be installed.

Once the installation is complete, you should see the following window.

If any dependency package is not available in the official package repository of Ubuntu or in any of the packages repositories you added through PPA, then the installation will fail. In that case, you will have to find and install the dependency packages manually as well.

So that’s how you install a DEB file on Ubuntu. Thanks for reading this article.

Sandclock IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, Sandclock IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install Arc GTK Theme on Ubuntu

There are a good number of available themes for revitalizing your experience on Ubuntu. In fact, almost all the Linux distros...
29/12/2020

Ubuntu User Management

User management is an important part of any Ubuntu/Linux system administrator’s job. It is also one of the most common...
28/12/2020

Install Packet Tracer on Ubuntu 18.04 LTS

If you’re a newbie in networking trying to get certifications such as Cisco CCENT or CCNA, then Packet Tracer will be...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Hướng dẫn chuyển đổi windows server windows evaluation to standard và active windows server 2008 + 2012 + 2016 + 2019
26/10/2021

How to Update Ubuntu Linux
24/10/2021

Squid Proxy Manager cài đặt và quản lý Proxy Squid tự động trên ubuntu
20/10/2021

Hướng dẫn cài đặt Apache CloudStack 4.15.2.0
19/10/2021

Hướng dẫn ký file PDF bằng chữ ký số (chữ ký điện tử) và sửa lỗi mới nhất 2021 foxit reader
19/10/2021