13

When using Fedora I usually use yum localinstall as a way to install a rpm obtained outside the distribution repositories. I can't find an equivalent option in the apt-get man page. I'm running Ubuntu 11.04, if that matters.

What is the apt-get equivalent of yum localinstall? Should I use dpkg directly in this case?

4 Answers 4

13

If you package depends on some other packages available in repositories, the following command will take care of installing dependencies too (which dpkg cannot do):

gdebi my_local_package.deb

however you may need to first install gdebi itself, if not already available on your Debian installation.

5
  • That's exactly what I was looking for! Thank you.
    – Vitor Py
    Sep 6, 2011 at 15:16
  • Just note, that this requires X. It's good for workstation. Not so good for server operated remotely. Sep 6, 2011 at 15:37
  • 2
    @Michał Šrajer: no, it do not need X, you talk about gdebi-gtk.
    – enzotib
    Sep 6, 2011 at 15:40
  • when trying gdebi solution, look for gdebi-core package for CLI only. it looks like gdebi is GTK by default. You can see the list of gdebi pkgs like so: apt-cache search gdebi. You want this one: "gdebi-core - simple tool to install deb files".
    – mighq
    Aug 24, 2014 at 16:46
  • If I have gdebi and apt installed on my laptop together, would they share the same configuration files? Assuming I use apt to install some packages, would gdebi know it?
    – Jack
    Jan 26, 2022 at 18:26
10

As said @enzotib, gdebi is nice, it even allows simple inspection of pre/post install script if your are a paranoid like me.

But don't forget the shell way, little padawan.

In a shell, "simply":

dpkg -i file.deb

If all dependencies are present, it will install. Else you will see an ugly and long error message but this is not the end of the world:

# dpkg -i somepackage.deb 
...snip...
dpkg: error processing somepackage (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 somepackage

Now, either install the missing dependencies or revert:

# apt-get install -f
...snip...
The following extra packages will be installed:
...snip...
Do you want to continue [Y/n]?
4

You need to use dpkg directly:

dpkg -i my_local_package.deb 

or setup your own local repository. I prefer to do just dpkg -i.

3
  • Is this the preferred way to do that on Debian-based distribution? On Fedora and RHEL I always use yum and never touch rpm directly.
    – Vitor Py
    Sep 6, 2011 at 14:43
  • I think it's fine. From official docs: "dpkg is a command-line tool used to install packages". Sep 6, 2011 at 14:49
  • As a note for future googlers, this answer will fail if the new package depends on other packages which are not already installed. dpkg checks dependencies, but does not fetch them, that's why apt and gdebi were made.
    – Knetic
    Mar 4, 2016 at 9:44
3

Simply: $sudo apt install ./your_package.deb

2
  • 1
    +1 for apt. gdebi isn't available by default and dpkg will do a partial installation unless dependencies are met. apt will install unmet dependencies before installing the deb package. Tip: this also works sudo apt install ./your_package.deb. Mar 5, 2021 at 11:06
  • Yep, that's the right answer nowadays. Question is ten years old though and apt-get was fussy back then :-)
    – Vitor Py
    Mar 13, 2021 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .