Software

Installing Applications With DPKG

If you are installing software via the terminal, you may want to learn more about installing applications with dpkg. It’s a simple process and I’ll also cover how to uninstall software with dpkg. It seems like the thing to do and it seems like a handy article to write, especially for new users.

You should probably know that apt is a frontend for dpkg and I’d suggest using apt to install software. That article does mention dpkg, but this article will be exclusively about installing (and removing) applications with dpkg.

The main reason I’d suggest using apt instead of dpkg is because apt will manage dependencies automatically. That’s a pretty handy feature. Still, you might as well learn to install applications with dpkg. You might as well also learn about uninstalling applications with dpkg.

This article only applies to distros that support dpkg as their package manager. That’d be distros like Debian, Ubuntu, Mint, and the many other Debian derivatives.

What is DPKG:

You won’t have to install anything. If your distro supports dpkg, it will be installed automatically. You can verify that dpkg is installed with the following command:

which dpkg

The reason for this being a Debian (and derivative) thing is obvious when you check the man page. If you do that, you’ll learn that dpkg is:

dpkg – package manager for Debian

Installing software is definitely managing packages. That means this is one of the correct tools for the job. There are graphical ways to do this and you can easily install software with gdebi.

Anyhow, you can even visit the dpkg homepage. That’s the tool we’ll be using to install software.

Installing Applications With DPKG:

This is one of those articles that requires an open terminal. That’s a fairly common thing around here and most of you know that you can open your default terminal simply by pressing CTRL + ALT + T.

With your terminal open, let’s all start on the same page…

cd ~/Downloads

In our example, we’ll use XnView MP. You can download that with this command:

wget https://download.xnview.com/XnViewMP-linux-x64.deb

If you’re using a 32-bit distro, there’s no current XnView MP available. They’ve stopped development, but you can download an older version.

wget https://download.xnview.com/XnViewMP-linux.deb

Now that you have XnView MP downloaded, you can install applications with dpkg with the following syntax:

sudo dpkg -i /path/to/<file_name>.deb

Or, in our case, we’d install XnView MP with this command:

sudo dpkg -i XnViewMP-linux-x64.deb

(Don’t forget that you can use autocomplete.)

See? It’s fairly easy to install applications with dpkg. I picked this XnView Multiplatform because it doesn’t have any dependencies in my testing. That keeps it relatively simple.

If there were dependencies, you could install them manually with dpkg. You can do that, or you can just use apt (which, again, you probably should have used in the first place). To do that, it’s simple:

sudo apt install -f

If you’re going to have to run an apt command after installing applications with dpkg, you might as well use apt in the first place. When you install packages with apt it will also resolve any dependencies (if those dependencies can be satisfied).

Removing Software with DPKG:

Yes, you will still need an open terminal if you want to remove software with dpkg. It only stands to reason. So, if you’re here for just this section of the article, open your terminal. There are directions above if you’re new to Linux.

The syntax to remove software with dpkg is also quite simple.

sudo dpkg -r <package>

NOTE: The package name is going to have a different name than the installation package, lacking at least the .deb portion. You can find the name with this command:

dpkg -l | grep <application_name>

So, in our example, we’d try a command like this:

dpkg -l | grep xnview

Sure enough, it returns this:

$ dpkg -l xnview
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-===================================
ii  xnview         1.4.4        amd64        Graphic viewer, browser, converter.

So, we can see the application name is not the same as the package name. In this case, the name is ‘xnview’. That means we’d use this to remove the package:

sudo dpkg -r xnview

That removes the application but it retains the configuration files. This means you can install the application at a later date and still have the same configuration you had before you removed the application.

See also: ‘sudo apt remove’ vs ‘sudo apt purge’

If you want to uninstall the application and remove the configuration files, you can just use the -P (purge) flag. The syntax follows:

sudo dpkg -P <application_name>

If we use this command with our example application, it’s like this:

sudo dpkg -P xnview

Now, if you want to pretend this article never happened, we can clean up after ourselves with the following command:

rm XnViewMP*.deb

That will delete the .deb file, meaning we’ve left no evidence behind (assuming you purged the application). Of course, you no longer have that particular graphics viewing, organizing, and light editing application installed. That’s entirely up to you.

Closure:

Well, if you ever needed to know about installing applications with dpkg, this was the article for you. We even discussed the process of removing the application and cleaning up after yourself. Good times!

If we wanted to be ‘more correct’, we’d say that we started with a package and installed an application. I figured I’d aim at the more generic words in hopes that newer users find this information and find it relatable.

There’s a limit to what you can ‘optimize’ for (meaning ranking in search engines) so I do what I must. I work on SEO (search engine optimization) because the site’s pointless if it doesn’t help anyone.

The whole goal is to get my notes (and more) online so that the site becomes a resource. More specifically, the end goal is to make Linux more approachable. Now if I could just make the site break even…

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Short: The Halt Command

Today's article is intentionally short because we're simply going to learn about the basics of…

20 hours ago

Installing Flatpaks In Linux

Today we're going to have a pretty easy article where you'll learn about installing Flatpaks…

3 days ago

A Quick Look At The Shutdown Command

This is going to be just a quick article about a command many of you…

5 days ago

Setting Up Coding Environments on Linux for Educational Use

With so many strong attributes, such as robustness and flexibility, Linux stands as a powerful…

7 days ago

View Detailed Hardware Information

There are many tools for showing your hardware information and today we'll get to view…

1 week ago

How To: Install Wine In Lubuntu

Today's article isn't going to be complicated or long as we are going to cover…

2 weeks ago