10

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?

2

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. – Akib Azmain Mar 5 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 at 12:36
10

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.

4
  • That's exactly what I was looking for! Thank you. – Vitor Py Sep 6 '11 at 15:16
  • Just note, that this requires X. It's good for workstation. Not so good for server operated remotely. – Michał Šrajer Sep 6 '11 at 15:37
  • 2
    @Michał Šrajer: no, it do not need X, you talk about gdebi-gtk. – enzotib Sep 6 '11 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 '14 at 16:46
9

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 '11 at 14:43
  • I think it's fine. From official docs: "dpkg is a command-line tool used to install packages". – Michał Šrajer Sep 6 '11 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 '16 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.