How to Install Deb Files on Ubuntu/Debian (Command Line)

How to Install Deb Files on Ubuntu/Debian (Command Line). In this post, we will explain what is deb package then show you a different method to install a deb file on the Ubuntu system.

What is a deb Package File?

Image Source: Howtogeek

A deb is a package format used in the Ubuntu and Debian based operating systems. Ubuntu and Debian have their own online repository that contains lots of deb packages. You can download and install it via apt, apt-get, or software center utility.

Some applications are not available on the Debian and Ubuntu repositories. In this case, you will need to download it from third party websites and install it manually. You will need to be careful while downloading and installing any application from a third party website.

A deb file is an archived file that ends with the .deb extension. It is very similar to Windows .exe file. When you double click on the .deb file, it will start the installation process in Ubuntu and Debian.

A Debian package or deb file contains the executable files, libraries, and documentation associated with a particular suite of programs or a set of related programs. Importantly, deb files are primarily used to install or update Unix applications. Each deb file is a standard Unix archive that contains two TAR archives: one for installer control information and another for installable data.

You can find the deb packages in the download section of a software provider’s website. For example, if you want to install Mozilla Firewall on Ubuntu, you can download the Mozilla Firefox deb package from its website.

Now it is the main part of the article How to Install Deb Files on Ubuntu/Debian (Command Line).

How to Install Deb Files on Ubuntu/Debian (Command Line)

There are several ways you can install deb files on Ubuntu and Debian operating systems. In this section, we will show you how to download and install the deb file on Ubuntu and Debian via the command line.

How to Download deb Files

In this section, we will show you how to download the TeamViewer deb file for demonstration purposes. You can download it either via a web browser or using the wget command line tool.

Open your web browser and visit the TeamViewer download page. Then, find the deb package and click on it to download it on your local system.

If you prefer the command line method then you can download it using the wget command:

				
					wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
				
			

You can also use the curl command line tool to download a deb file. To download a TeamViewer deb file via the curl command, run the following command:

				
					curl -k -O -L https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
				
			

At this point, you are familiar with how to download a deb file on Ubuntu. You can now learn how to install deb files via the command line in the next section.

Install deb Files with dpkg Command

Image Source: Brsmedia

The dpkg is a package manager for Ubuntu and Debian based operating systems. Used to install and remove software packages. It extracts the deb file, removes any previously installed package, and installs the new package on the system.

This is a low level package management tool to extract, analyze, unpack and install or remove deb files. However, it is recommended to use Software Centre, apt or Gdebi to install or remove deb files because they have dependency resolution.

The basic syntax of the dpkg command is shown below:

				
					dpkg -i [deb-package-name]
				
			

For example, if you want to install the downloaded TeamViewer package, run the following command:

				
					dpkg -i teamviewer_amd64.deb
				
			

Compared to the apt and gdebi utilities, the dpkg command does not resolve the dependencies. In this case, you can run the following command to install all required dependencies:

				
					apt install -f
				
			

This will download and install all dependencies required for TeamViewer. Once you are familiar with the dpkg command, you can proceed to the next section.

Install deb Files with apt Command

Image Source: Linuxfordevices

The apt also known as “Advanced Packaging Tool”, is a powerful command line tool to install, remove, update and manage software packages on Ubuntu and Debian based operating systems.

The basic syntax to install the deb file with the apt command is shown below:

				
					apt install [deb-package-name]
				
			

For example, you can install the TeamViewer deb file using the following command:

				
					apt install ./teamviewer_amd64.deb
				
			

This command will install TeamViewer and related dependencies automatically. Once you are familiar with the apt command, you can proceed to the next section.

Install deb Files with gdebi Command

Image Source: YouTube

The gdebi is a small and lightweight package management tool that allows you to install deb files more effectively by handling dependencies. Recommended to use the gdebi because it is more efficient and quicker as compared to the default Ubuntu installer.

By default, the gdebi package manager is not installed in Ubuntu. You can install it using the following command:

				
					apt install gdebi -y
				
			

The basic syntax to install the deb file with gdebi is shown below:

				
					gdebi [deb-package-name]
				
			

Now, if you want to install the downloaded TeamViewer deb file, run the following command:

				
					gdebi teamviewer_amd64.deb
				
			

You will be asked to type y to proceed with the installation.

Install deb Files with Graphical Software Center

In addition, Ubuntu also provides a Graphical Software Center that allows you to install a deb file via a graphical interface. It is a discontinued high-level graphical front end for the apt and dpkg package management system. Software Center is very useful for those who are not familiar with the command line interface.

To install a deb file via GUI follow the below steps:

Step 1 – Open the file manager and go to the download folder where you download a deb file.

Step 2 – Right click on the deb file and click on Open with Software Install. You should see the following screen:

Step 3 – Click on the Install button. You will be asked to authenticate as shown below:

Step 4 – Provide your administrative password and click on the Authenticate button to start the installation process. The installation process will take some time based on the size of the file.

How to Remove a Software Package via Command Line

You can remove or uninstall software installed by deb file using the dpkg or the apt command line tool.

Remove a Package Using apt Command

Before removing any package, you will need to find out the exact package name that you want to remove from your system. You can find the list of all installed package files using the apt command. However, finding your package from the generated list is a time consuming process. In this case, you can use the grep command to filter the result.

For example, to find out the exact package name of Google Chrome, run the following command:

				
					apt list --installed | grep -i chrome
				
			

You should see the exact package name in the following output:

				
					google-chrome-stable/now 104.0.5112.79-1 amd64 [installed,upgradable to: 107.0.5304.110-1]
				
			

Now, you can remove or uninstall a Google Chrome package with apt using the following command:

				
					apt remove google-chrome-stable
				
			

Remove a Package Using dpkg Command

You can also find out the exact package name using the dpkg command.

				
					dpkg -l | grep -i chrome
				
			

You should see the exact package name in the following output:

				
					ii google-chrome-stable 104.0.5112.79-1 amd64 The web browser from Google
				
			

Now, you can uninstall a package with dpkg using the following command:

				
					dpkg -r google-chrome-stable
				
			

Thank you for reading How to Install Deb Files on Ubuntu/Debian (Command Line). We shall conclude. 

How to Install Deb Files on Ubuntu/Debian (Command Line) Conclusion

In this guide, we explained different ways to install a deb file on Ubuntu and Debian based operating systems. We also explained how to remove or uninstall software packages via the command line. You can now choose your preferred method to install a deb file on your system as per your requirements. Both apt and dpkg are very useful and powerful tools that allow you to easily install, remove and manage packages on Ubuntu or Debian based operating systems.

Check out more of Ubuntu content in our blog over here

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x