HOWTO: Use dpkg to Install .deb Files.

November 27, 2005 by Jon  
Filed under How To

I’ve written about using apt-get to get and install debian packages. However, a recent comment by a reader brought the fact that I hadn’t written anything on what to do with a .deb file that exists on your system already either by download or other media.

Using the apt-get application is the quickest way to find and install debian packages. The installation part is done by an application named dpkg. Dpkg doesn’t have to be used by apt-get, you can use it manually as well.

From the man dpkg command:

dpkg - a medium-level package manager for Debian

Whatever that means.

In keeping with GNU/Linux system security, only the superuser can use the dpkg application. Dpkg is a typical GNU/Linux application that is controlled by command-line switches. Possibly the most common use of dpkg is to install a local .deb file.

To install a .deb file, become root and use the command:

dpkg -i filename.deb

Dpkg can also be used to:

  • dpkg –unpack: unpacks the file but does not install it
  • dpkg –configure: presents whatever configuration options are available for the package
  • dpkg –remove: removes a package

Some of the package manipulation commands are actually carried out by an application called dpkg-deb. In those cases, dpkg just acts as a front end to dpkg-deb and passes the commands to it.

Dpkg-deb can also be used to manipulate .deb files. Some of the more useful commands of dpkg-deb are:

dpkg-deb –show filename.deb

This will display the information for filename.deb. Normally, this is boring information like the application version (which is normally evident from the filename), but in some cases more interesting and useful information is displayed.

Consult the dpkg man page for information on the more arcane uses for dpkg.

Share and Enjoy:
  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Reddit
  • Yahoo! Buzz
  • Slashdot
  • E-mail this story to a friend!

Comments

49 Responses to “HOWTO: Use dpkg to Install .deb Files.”
  1. Oliviu says:

    Hi Jon,

    That’s the answer I was looking for.
    Thank you for the swift and competent response.
    As a Linux newbie that I am, I spent a little more time reading the net and man help files and finally found out about the dpkg command
    just had to Read The Fine Manual ;).

    Regards,
    Oliviu

  2. Jon says:

    Right on, glad it helped!

  3. Bart says:

    Fond it at last.
    Just wanted to install a .deb file on several machines without having to download in every time again.
    apt-get is a magnificant tool, nevertheless.
    Thanks.

  4. Jon says:

    It seems that a few people were looking for this information. I really don’t know how I could have missed covering off dpkg when I did apt-get…sheesh.

    Sorry guys!

  5. shane says:

    I get some dependency errors while trying to use dpkg. Anyone have info on that?

  6. Jon says:

    What’s the package you’re trying to install?

    I ask because dpkg by itself isn’t able to resolve dependency issues. However, apt-get will (in most cases) resolve dependency issues for you. If you’re trying to install a *.deb that is available in the repositories, you may be able to ‘apt-get install package’ instead of dpkg’ing the local file and get it working.

  7. shane says:

    I am trying to install Opera 8.51.

    It is not available via the repositories as far as I can tell and dpkg gives me dependency problems that I am not entirely sure how to resolve. It ends up just breaking the package.

    It’s not a huge deal if I can’t get Opera working obviously, but I would feel alot better if I knew how to resolve this in general.

  8. Pieter says:

    all what i need is a complet, dutch, FAQ, forum, …. where i can find help. i’m only 14 years old, my english is very bad. Thanks for this explanation over the dkpg command!!!!!!!!!!

  9. Jon says:

    Hi Pieter.

    I wish I spoke Dutch, I would translate for you. But I don’t… :(

  10. jacques says:

    for the dutch-ees
    dit zijn nederlandstalige nieuwsgroepen op usenet (nntp)
    nl.comp.os.linux.discussie
    nl.comp.os.linux.overige
    nl.comp.os.linux.netwerken
    nl.comp.os.linux.installatie

    en hier vind je heel wat nederlandstalige info
    http://doc.nl.linux.org/
    http://www.nluug.nl/
    succes joh

  11. Done! says:

    “dpkg -i filename.deb”
    that’s work good

    (i click some sponsors:P) Thank you.

    thepumpkin1979@gmail.com

  12. Jon says:

    Thanks Done!

    :)

  13. Josh says:

    Thanks for this info! I am yet another semi-newbie that was searching to figure out which command would allow installation from a local .deb.

    On the topic of conflicts/missing dependencys with dpkg, once it coughs up a missing dependency, I will usually just apt-get install the missing package that dpkg complained wasn’t there, before running the dpkg -i .deb command again. It seems to work fairly well, unless you find something that wants a specific *version* of the file and that version is no longer there.. (Aqualung.. :p )

    Thanks again!

  14. Jon says:

    Hey Josh,

    Glad this helped. I use the same tactic as you and in many cases it works. Every now and again it fails if the dependency either doesn’t exist in the repository or is too many levels deep, but most of the time it works :)

  15. Shailesh Solanki says:

    i want to install .deb package in redhat fedora.plz specify

  16. Jon says:

    Hi Shailesh,

    Well, a .deb package isn’t made for Red Hat or Fedora. RH and Fedora are both RPM-based distros so you should try to find an .rpm package for them.

    However, if you’re completely stuck and all you have in a .deb, then you can probably use the application ‘alien’ to turn it into a .deb and then install it as per the dpkg instructions I’ve provided.

    Alien: http://www.newlinuxuser.com/howto-install-an-rpm-package-on-a-debian-box/

  17. Lutfi says:

    As it is said, that is exactly what i’m looking for,

    Thanks

  18. cas says:

    After fiddling with some issues.. this solved my problem… Thanks…

  19. lou graue says:

    How can I install kmymoney on my Ubuntu system? I have downloaded a .rpm version but that will not work.

  20. bramgn says:

    try running the command “apt-get install –fix-broken” after you have installed a ‘local’ package with “dpkg -i “. It will try to install the needed dependencies from its repository.

  21. g. says:

    hi

    nice and very useful info!

    but there’s a little typo. it should be:

    dpkg-deb –-show filename.deb

    note the extra -.

    /g.

  22. Ronald S. says:

    (linux version:6.02.6.14-kanotix-6)
    when i try, for example:
    # sudo dpkg –install –force-all klavaro_1.0.2_i386.deb
    i get…
    dpkg: syntax error: unknown group ‘cdrom’ in statusoverride file

    May you help me?
    Thanks for your attention.

  23. Zam says:

    Thanks for this, its a quick & easy solution to what i wanted ;)

    Thanks man =D

  24. Sam says:

    Hi,
    I have an i386 deb file, is it possible to install on a amd64 (ubuntu) system?

    /S

  25. Iain Houston says:

    if a deb file is corrupted what is the way to delete it and refresh it from perhaps a different mirror … using the dpkg tool or synaptic to maintain the package database?

  26. Heya!

    Alright, seems to be working for everyone else…. Issue Im having while running the command via the Terminal, is every .deb file im attempting to install:
    dpkg: requested operation requires superuser privilege

    What pisses me off, is the fact that I believe that Im using a horrible Distro of linux “FREESPIRE”

    What is the issue that I am having? ANY addl. comments, PLEASE forward to me, twitch_ns@hotmail.com

    Im running FreeSpire on my HP Pavillion zt1260 Pentium 4, 40GB HD, attempting to install Alien for Running/repackaging RPM file(s) to *.deb.

  27. trevisa says:

    How do I install the DPKG itself?

  28. Stranger says:

    dpgk is already installed. But man dpkg is not working. If you write > whereis dpkg you will see that it is included in debian and its path. So everything is workin. thanks.

  29. Lean 946 says:

    Hi, Jordon Fenton:
    To become a root user without being one, you can type “sudo” before the commands.

    lean.946@gmail.com

    PD: Thanks for the help with the dpkg utility!!!

  30. bramgn says:

    Lean: sudo is a great utility for doing just those tasks which require root privileges without having to actually ‘become’ root. Before one is able to use sudo, though, you have to specifically tell sudo that you are allowed to use it. With the command visudo you can edit its configuration by adding your username (or alternatively comment out the group which is allowed to use sudo; make sure you are in that group).

  31. Reporter says:

    If the .deb file is downloaded to the desktop you can just click on the .deb icon, select open and the Package Installer will take care of it for you.

  32. Sx66gns says:

    Thanks for this site , it’s great , I like the human humor as well , this tip simple as it is helped me , thank you , keep up the good work.

  33. Lawrence says:

    Glad its worked for you guys. I have managed to install it using Kate from freespire 2.0.8 and the terminal reads setting up [filename]…
    but then what happens? Where is it. Thats seems to be the last that happens and I dont know how and where to open it.
    U had to first convert my tight vnc server from rmp file to a deb file using alien.cdr and the go into root and install the deb file. can anyone help me! Cheers.

  34. Correction says:

    There is an error in this article. It should be “dpkg –show filename.deb” (note the double hyphen). Otherwise, thanks for the tips!

  35. naveen says:

    just can you say something deep about how dpkg will prepare and what are all the steps that it would perform before and after installation of an .deb files.

  36. mustakim says:

    how to install many deb in one command? I don’t need aptoncd, I just want to learning how to install over 50 units of deb in one command in terminal. sudo dpkg -i package.deb just only install one by one. Any ideas?

  37. Ravi Kant says:

    hi

    Well I am trying to install qt package for Debian kernel 2.6

    I downloded qt3-designer_3.3.4-3sarge3_i386.dep package

    while using command
    apt-get install qt3-designer_3.3.4-3sarge3_i386.dep
    The message displayed is
    Reading package lists… Done
    Building dependency tree… Done
    E: Couldn’t find package qt3-designer_3.3.4-3sarge3_i386.dep

    After trying with command dpkg -i qt3-designer_3.3.4-3sarge3_i386.dep

    (Reading Database …. 66812 files and directories currently nstalled)
    Preparing to replace qt3-designer 3:3.3.4-3sarge3 (using qt3-designer_3.3.4-3sarge3_i386.dep ) …
    Unpacking replacement qt3-designer …
    dpkg-dep: subprocess paste killed by signal (Broken pipe)
    dpkg: error processing qt3-designer_3.3.4-3sarge3_i386.dep (–install):
    returned error exit status 2
    Errors were encountered while processing
    qt3-designer_3.3.4-3sarge3_i386.dep

  38. Ravi Kant says:

    What is the problem and how could it be sorted out.
    kindly reply at ravikantbansal2004@gmail.com

  39. naveen says:

    hi,
    can you say about how dpkg would build the dependence tree before installing a package.

  40. O2O says:

    I’ve just used Ubuntu. So It’s too difficult.
    When i type: sudo apt-get install -f
    —>
    o2o@o2o-desktop:/root$ sudo apt-get install -f
    E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
    So, can you help me fix it?
    Thanks!!!

  41. Luis says:

    I have two .deb files. When I try to install them they ask for a dependency, but package 1 needs package 2 and vice versa. I thought I could install them together but I dont know how to do it, can someone help me? Thank you.

  42. Carlos Jones says:

    I had some troubles installing Asterisk on ubuntu and needed to install libncurses5-dev, this post helped me to solve the situation. Thanks a lot.

  43. CrazyGangster says:

    Hii everyone

    I try install Virtual Box in Damn Small, it’s possible?
    Thanks

  44. Thomas says:

    Thank you for the easy to understand explanation of how to install a .deb file.

  45. RainCT says:

    You can also use “gdebi” (or it’s graphical interface, “gdebi-gtk”), which will install any missing dependencies.

Trackbacks

Check out what others are saying about this post...
  1. [...] If you are studying apt and dpkg, here is a nice how-to that got me over that particular hump. [...]

  2. [...] found this page today that finally helped me understand how to install applications in Linux:  HOWTO: Use dpkg to Install .deb Files:  To install a .deb file, become root and use the command: dpkg -i [...]

  3. [...] Article on what to do with .deb files [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


About Us | Advertise with us | Blog for EveryJoe | Privacy Policy | Terms of Use
Get This Theme


All content is Copyright © 2005-2009 b5media. All rights reserved.