How to Install or Remove DEB Packages Using dpkg (Ubuntu / Debian)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

This post explains how to install, uninstall, verify deb packages on Debian or Ubuntu. dpkg is the command that allows one to install or uninstall a .deb package in Ubuntu or Debian Linux. Here is how to use it.

Before we begin, it is important to note that you should use dpkg only in the event of unavailability of package through apt-get or aptitude.

Installing a Deb Using dpkg -i

syntax: dpkg -i package-file-name

-i is to install a package. To verify or check for a package already installed use dpkg -l followed by grepping for packagename as shown below:

dpkg -l | grep -i 'subsonic'

Output would show something like this:

ii  subsonic    4.7    A web-based music streamer, jukebox and Podcast receiver

The above command shows that the package subsonic is installed properly. ‘ii’ specifies status ‘installed ok installed’.

Removing or Uninstalling a Deb using dpkg -r

dpkg with -r option removes the installed package. As shown below:

sudo dpkg -r subsonic
(Reading database ... 42139 files and directories currently installed.)
Removing subsonic ...
 Removing any system startup links for /etc/init.d/subsonic ...
   /etc/rc0.d/K99subsonic
   /etc/rc1.d/K99subsonic
   /etc/rc2.d/S99subsonic
   /etc/rc3.d/S99subsonic
   /etc/rc4.d/S99subsonic
   /etc/rc5.d/S99subsonic
   /etc/rc6.d/K99subsonic
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot

Now lets check the status of the package again.

dpkg -l | grep -i 'subsonic'
rc  subsonic  4.7   A web-based music streamer, jukebox and Podcast receiver

rc stands for ‘removed ok config-files’. The remove action doesn’t purge the configuration files. The status of each installed package will be available in /var/lib/dpkg/status. We can remove the config files using this:

sudo dpkg -P subsonic
(Reading database ... 42131 files and directories currently installed.)
Removing subsonic ...
Purging configuration files for subsonic ...
 Removing any system startup links for /etc/init.d/subsonic ...
dpkg: warning: while removing subsonic, directory '/var/subsonic' not empty so not removed.

That should remove the package completely.

You might also like

Install libstdc++.so.5 on Ubuntu 10.10 or 10.04 or 9.10 If you try...
Install libstdc++.so.5 on Ubuntu 11.04 Natty Narwhal If you try...
Transfer Installed Applications to Fresh Ubuntu Installation If you bought...
Install VirtualBox 3.2 on Ubuntu 10.04 Lucid Lynx VirtualBox...

About the Author

has written 346 posts on this blog.

Meditating towards his "nerdvana", lifehacker is a teacher by the day and a nerdy blogger by the night. He lives to learn and yearns to learn living.

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2017 Hack Your Life!. All rights reserved.
Proudly powered by WordPress. Developed by Deluxe Themes