HOWTO: Use dpkg to Install .deb Files.

Posted in Technology
Sun, Nov 27 - 9:29 am EDT | 9 years ago by
Comments: 57
Share This Post:
  • Facebook
  • StumbleUpon
  • Tumblr
  • Reddit
  • Twitter

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.

Related Posts

Share This Post:
  • Facebook
  • StumbleUpon
  • Tumblr
  • Reddit
  • Twitter
  • Oliviu

    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

  • http://www.newlinuxuser.com Jon

    Right on, glad it helped!

  • Bart

    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.

  • http://www.newlinuxuser.com Jon

    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!

  • shane

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

  • http://www.newlinuxuser.com Jon

    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.

  • shane

    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.

  • Pieter

    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!!!!!!!!!!

  • http://www.newlinuxuser.com Jon

    Hi Pieter.

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

  • http://nosite.noti.me jacques

    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

  • Done!

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

    (i click some sponsors:P) Thank you.

    thepumpkin1979@gmail.com

  • http://www.newlinuxuser.com Jon

    Thanks Done!

    :)

  • Josh

    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!

  • http://www.newlinuxuser.com Jon

    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 :)

  • Shailesh Solanki

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

  • http://www.newlinuxuser.com Jon

    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/

  • Lutfi

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

    Thanks

  • cas

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

  • Pingback: Velo, Rapido: Going Places » Blog Archive » I might hate my computer but I love my blog (and Marius)_

  • lou graue

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

  • http://sorry bramgn

    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.

  • g.

    hi

    nice and very useful info!

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

    dpkg-deb –-show filename.deb

    note the extra -.

    /g.

  • Ronald S.

    (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.

  • Zam

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

    Thanks man =D

  • Sam

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

    /S

  • Pingback: Thu Tu’s Blog » How to Install Applications on Linux

  • Iain Houston

    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?

  • http://www.myspace.com/twitchns Jordon Fenton

    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.

  • trevisa

    How do I install the DPKG itself?

  • Stranger

    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.

  • Lean 946

    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!!!

  • bramgn

    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).

  • Reporter

    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.

  • http://www.fluxbuntu.org Sx66gns

    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.

  • Lawrence

    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.

  • http://N/A Correction

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

  • naveen

    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.

  • http://www.myspace.com/gutsygibbon mustakim

    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?

  • Ravi Kant

    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

  • Ravi Kant

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

  • naveen

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

  • O2O

    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!!!

  • Luis

    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.

  • Carlos Jones

    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.

  • Pingback: Metal Shaper Man’s Blog

  • CrazyGangster

    Hii everyone

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

  • Pingback: Just Another Blog » Blog Archive » Lidt om pakker, download og install

  • Thomas

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

  • http://eurion.net RainCT

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

  • SPENCE

    For the time being I am going to have to run my Ubuntu off line. No etherhet I/O.

    I need URLS for download sites for ,deb files.

    What directory should I copy the downloaded files to for installation.

    Then I need install procedures.

  • haris

    Hey there.
    Thanks for this fine instruction!

  • http://beam.to/ooberules Bill

    wow for over a week i have been trying to figure out how to get flash to work thanks to this page i found out how to install the install_flash_player_10_linux.deb since the apt-get install flashplugin-nonfree didnt work but this page was alot of help

  • Brinjal

    It should be:
    dpkg-deb –show filename.deb

  • Jane

    When trying to install two deb files “Broken dependencies” is displayed on package installer . Someone can help me.

  • herakles

    @bramgn

    well done
    thank u

  • SamHoratio

    Go to the directory where the packages are and type:

    sudo dpkg -i *.deb

    This might work. It does install all the .deb packages in the directory but I’m not sure exactly how it handles dependencies.

  • SPENCE

    First I want to install tree.deb so i can easily see the Linux layout. (Its easier to go somewhere if you have a roadmap.